Skip to content

Commit

Permalink
Fix #72 (I hope)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 27, 2015
1 parent 9cafbfa commit 33afa0f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package com.fasterxml.jackson.datatype.hibernate4;

import javax.persistence.Transient;

import org.hibernate.bytecode.internal.javassist.FieldHandler;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;

import javax.persistence.Transient;
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;

/**
* Simple {@link com.fasterxml.jackson.databind.AnnotationIntrospector} that adds support for using
* {@link javax.persistence.Transient} to denote ignorable fields (alongside with Jackson
* and/or JAXB annotations).
*/
public class HibernateAnnotationIntrospector extends AnnotationIntrospector
public class HibernateAnnotationIntrospector extends NopAnnotationIntrospector
{
private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -67,4 +70,18 @@ public Version version() {
public boolean hasIgnoreMarker(AnnotatedMember m) {
return _cfgCheckTransient && m.hasAnnotation(Transient.class);
}

@Override
public Boolean isIgnorableType(AnnotatedClass ac)
{
/* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling
* of `FieldHandled`. Not sure if it works without test (alas, none provided),
* but will try our best -- problem is, if it'
*/
// ... could we avoid direct class reference?
if (FieldHandler.class.isAssignableFrom(ac.getAnnotated())) {
return Boolean.TRUE;
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.fasterxml.jackson.datatype.hibernate5;

import javax.persistence.Transient;

import org.hibernate.bytecode.internal.javassist.FieldHandler;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;

import javax.persistence.Transient;

/**
* Simple {@link com.fasterxml.jackson.databind.AnnotationIntrospector} that adds support for using
* {@link javax.persistence.Transient} to denote ignorable fields (alongside with Jackson
Expand Down Expand Up @@ -67,4 +70,18 @@ public Version version() {
public boolean hasIgnoreMarker(AnnotatedMember m) {
return _cfgCheckTransient && m.hasAnnotation(Transient.class);
}

@Override
public Boolean isIgnorableType(AnnotatedClass ac)
{
/* 26-Dec-2015, tatu: To fix [datatype-hibernate#72], need to suppress handling
* of `FieldHandled`. Not sure if it works without test (alas, none provided),
* but will try our best -- problem is, if it'
*/
// ... could we avoid direct class reference?
if (FieldHandler.class.isAssignableFrom(ac.getAnnotated())) {
return Boolean.TRUE;
}
return null;
}
}
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Project: jackson-datatype-hibernate

2.7.0 (not yet released)

#72: Should ignore org.hibernate.bytecode.internal.javassist.FieldHandled.getFieldHandler()
#79: Upgrade hibernate5 dep to latest Hibernate version, 5.0.6

2.6.3 (12-Oct-2015)
Expand Down

0 comments on commit 33afa0f

Please sign in to comment.