Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public class PersistenceMetaDataDefaults
protected MemberFilter methodFilter = new MemberFilter(Method.class);
protected TransientFilter nonTransientFilter = new TransientFilter(false);
protected AnnotatedFilter annotatedFilter = new AnnotatedFilter();
protected AccessTypeFilter accessTypeFilter = new AccessTypeFilter();
protected GetterFilter getterFilter = new GetterFilter();
protected SetterFilter setterFilter = new SetterFilter();
private Boolean _isAbstractMappingUniDirectional = null;
Expand Down Expand Up @@ -526,42 +525,6 @@ cls, toFieldNames(uniqueAccessFields),
return AccessCode.UNKNOWN;
}

/**
* Checks whether the given class has JPA annotations on both fields AND
* getters, indicating mixed annotation placement.
*/
private boolean hasMixedAnnotations(Class<?> cls, OpenJPAConfiguration conf) {
Field[] allFields = cls.getDeclaredFields();
Method[] methods = cls.getDeclaredMethods();
List<Field> fields = filter(allFields, new TransientFilter(true));
getterFilter.setIncludePrivate(
conf.getCompatibilityInstance().getPrivatePersistentProperties());
List<Method> getters = filter(methods, getterFilter);
fields = filter(fields, annotatedFilter);
getters = filter(getters, annotatedFilter);
List<Method> setters = filter(methods, setterFilter);
getters = matchGetterAndSetter(getters, setters);
return !fields.isEmpty() && !getters.isEmpty();
}

private boolean hasFieldStrategyAnnotations(Class<?> cls) {
for (Field f : cls.getDeclaredFields()) {
if (accessTypeFilter.includes(f)) {
return true;
}
}
return false;
}

private boolean hasGetterStrategyAnnotations(Class<?> cls) {
for (Method m : cls.getDeclaredMethods()) {
if (accessTypeFilter.includes(m)) {
return true;
}
}
return false;
}

/**
* Explicit access type, if any, is generally detected by the parser. This
* is only used for metadata of an embeddable type which is encountered
Expand Down Expand Up @@ -1155,27 +1118,6 @@ public boolean includes(AnnotatedElement obj) {
}
}

/**
* Filter that includes only members annotated with access-type-determining
* annotations: persistence strategy annotations (@Id, @Basic, @ManyToOne, etc.),
* @Version, and @EmbeddedId. Supplementary annotations like @Column,
* @JoinColumn, @Enumerated do NOT determine the access type per JPA spec.
*/
static class AccessTypeFilter implements InclusiveFilter<AnnotatedElement> {
@Override
public boolean includes(AnnotatedElement obj) {
for (Annotation anno : obj.getAnnotations()) {
Class<?> type = anno.annotationType();
if (_strats.containsKey(type)
|| type == Id.class
|| type == Version.class) {
return true;
}
}
return false;
}
}

private void logNoSetter(ClassMetaData meta, String name, Exception e) {
Log log = meta.getRepository().getConfiguration()
.getLog(OpenJPAConfiguration.LOG_METADATA);
Expand Down
Loading