diff --git a/depedence-adapter/README.md b/depedence-adapter/README.md deleted file mode 100644 index 411806a1e..000000000 --- a/depedence-adapter/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# dependence-adapter - -该模块为一个辅助的中间模块,为改过包名的第三方包之间的相互引用作适配 diff --git a/depedence-adapter/src/com/fr/third/adapter/druid/DruidConnectionProvider.java b/depedence-adapter/src/com/fr/third/adapter/druid/DruidConnectionProvider.java deleted file mode 100644 index 1b8234829..000000000 --- a/depedence-adapter/src/com/fr/third/adapter/druid/DruidConnectionProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fr.third.adapter.druid; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Map; - -import com.fr.third.org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; -import com.fr.third.org.hibernate.service.spi.Configurable; -import com.fr.third.org.hibernate.service.spi.Stoppable; - -import com.fr.third.alibaba.druid.pool.DruidDataSource; -import com.fr.third.alibaba.druid.pool.DruidDataSourceFactory; - -public class DruidConnectionProvider implements ConnectionProvider, Configurable, Stoppable { - - private static final long serialVersionUID = 1026193803901107651L; - - private DruidDataSource dataSource; - - public DruidConnectionProvider(){ - dataSource = new DruidDataSource(); - } - - @SuppressWarnings("rawtypes") - @Override - public boolean isUnwrappableAs(Class unwrapType) { - return dataSource.isWrapperFor(unwrapType); - } - - @Override - public T unwrap(Class unwrapType) { - return dataSource.unwrap(unwrapType); - } - - @Override - public Connection getConnection() throws SQLException { - return dataSource.getConnection(); - } - - @Override - public void closeConnection(Connection conn) throws SQLException { - conn.close(); - } - - @Override - public boolean supportsAggressiveRelease() { - return false; - } - - @SuppressWarnings("rawtypes") - @Override - public void configure(Map configurationValues) { - try { - DruidDataSourceFactory.config(dataSource, configurationValues); - } catch (SQLException e) { - throw new IllegalArgumentException("config error", e); - } - } - - @Override - public void stop() { - dataSource.close(); - } - -} diff --git a/fine-classmate/README.md b/fine-classmate/README.md new file mode 100644 index 000000000..a8396408a --- /dev/null +++ b/fine-classmate/README.md @@ -0,0 +1,6 @@ +# fine-classmate + +改包名的classmate(1.3.0),以下模块需要依赖该模块: + +- fine-hibernate + diff --git a/depedence-adapter/depedence-adapter.iml b/fine-classmate/fine-classmate.iml similarity index 76% rename from depedence-adapter/depedence-adapter.iml rename to fine-classmate/fine-classmate.iml index 5ad2e8899..c90834f2d 100644 --- a/depedence-adapter/depedence-adapter.iml +++ b/fine-classmate/fine-classmate.iml @@ -7,7 +7,5 @@ - - \ No newline at end of file diff --git a/fine-classmate/src/com/fasterxml/classmate/AnnotationConfiguration.java b/fine-classmate/src/com/fasterxml/classmate/AnnotationConfiguration.java new file mode 100644 index 000000000..2d1c51965 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/AnnotationConfiguration.java @@ -0,0 +1,115 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; +import java.lang.annotation.Annotation; +import java.util.*; + +import com.fasterxml.classmate.util.ClassKey; + +/** + * Interface for object that determines handling of annotations in regards + * to inheritance, overrides. + */ +@SuppressWarnings("serial") +public abstract class AnnotationConfiguration implements Serializable +{ + /** + * Method called to figure out how to handle instances of specified annotation + * type when used as class annotation. + */ + public abstract AnnotationInclusion getInclusionForClass(Class annotationType); + + /** + * Method called to figure out how to handle instances of specified annotation + * type when used as constructor annotation. + *

+ * Note that constructor annotations can never be inherited so this just determines + * between inclusion or non-inclusion. + */ + public abstract AnnotationInclusion getInclusionForConstructor(Class annotationType); + + /** + * Method called to figure out how to handle instances of specified annotation + * type when used as field annotation. + *

+ * Note that field annotations can never be inherited so this just determines + * between inclusion or non-inclusion. + */ + public abstract AnnotationInclusion getInclusionForField(Class annotationType); + + /** + * Method called to figure out how to handle instances of specified annotation + * type when used as method annotation. + *

+ * Note that method annotations can be inherited for member methods, but not for static + * methods; for static methods thereby this just determines between inclusion and + * non-inclusion. + */ + public abstract AnnotationInclusion getInclusionForMethod(Class annotationType); + + /** + * Method called to figure out how to handle instances of specified annotation + * type when used as parameter annotation. + *

+ * Note that parameter annotations can be inherited for member methods, but not for static + * methods; for static methods thereby this just determines between inclusion and + * non-inclusion. + */ + public abstract AnnotationInclusion getInclusionForParameter(Class annotationType); + + /** + * Simple implementation that can be configured with default behavior + * for unknown annotations, as well as explicit behaviors for + * enumerated annotation types. Same default is used for both class and + * member method annotations (constructor, field and static method + * annotations are never inherited) + */ + public static class StdConfiguration extends AnnotationConfiguration implements Serializable + { + protected final AnnotationInclusion _defaultInclusion; + + protected final HashMap _inclusions = new HashMap(); + + public StdConfiguration(AnnotationInclusion defaultBehavior) + { + _defaultInclusion = defaultBehavior; + } + + @Override + public AnnotationInclusion getInclusionForClass(Class annotationType) { + return _inclusionFor(annotationType); + } + + @Override + public AnnotationInclusion getInclusionForConstructor(Class annotationType) { + return _inclusionFor(annotationType); + } + + @Override + public AnnotationInclusion getInclusionForField(Class annotationType) { + return getInclusionForClass(annotationType); + } + + @Override + public AnnotationInclusion getInclusionForMethod(Class annotationType) { + return getInclusionForClass(annotationType); + } + + @Override + public AnnotationInclusion getInclusionForParameter(Class annotationType) { + return getInclusionForClass(annotationType); + } + + public void setInclusion(Class annotationType, AnnotationInclusion incl) + { + _inclusions.put(new ClassKey(annotationType), incl); + } + + protected AnnotationInclusion _inclusionFor(Class annotationType) + { + ClassKey key = new ClassKey(annotationType); + AnnotationInclusion beh = _inclusions.get(key); + return (beh == null) ? _defaultInclusion : beh; + } + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/AnnotationInclusion.java b/fine-classmate/src/com/fasterxml/classmate/AnnotationInclusion.java new file mode 100644 index 000000000..3587c2300 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/AnnotationInclusion.java @@ -0,0 +1,44 @@ +package com.fasterxml.classmate; + +/** + * Enumeration that defines different settings for handling behavior + * of individual annotations + */ +public enum AnnotationInclusion +{ + /** + * Value that indicates that annotation is to be ignored, not included + * in resolved bean information. + * Applicable to all member types. + */ + DONT_INCLUDE, + + /** + * Value that indicates that annotation is to be included in results, but + * only if directly associated with included member (or attached mix-in); + * will not inherit from supertypes. + * Applicable only to member methods; if used with other members will + * mean basic inclusion. + */ + INCLUDE_BUT_DONT_INHERIT, + + /** + * Value that indicates that annotation is to be included in results, and + * values from overridden members are inherited only if the annotation is + * marked with the {@link java.lang.annotation.Inherited} annotation. + * Applicable only to member methods; if used with other members will + * mean basic inclusion. + */ + INCLUDE_AND_INHERIT_IF_INHERITED, + + /** + * Value that indicates that annotation is to be included in results; and + * values from overridden members are also inherited if not overridden + * by members of subtypes. + * Note that inheritance only matters with member methods; for other types + * it just means "include". + */ + INCLUDE_AND_INHERIT + ; + +} diff --git a/fine-classmate/src/com/fasterxml/classmate/AnnotationOverrides.java b/fine-classmate/src/com/fasterxml/classmate/AnnotationOverrides.java new file mode 100644 index 000000000..28abd4bc8 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/AnnotationOverrides.java @@ -0,0 +1,100 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; +import java.util.*; + +import com.fasterxml.classmate.util.ClassKey; + +/** + * Interface for object that can provide mix-ins to override annotations. + */ +@SuppressWarnings("serial") +public abstract class AnnotationOverrides implements Serializable +{ + /* + /********************************************************************** + /* Public API + /********************************************************************** + */ + + /** + * Method called to find out which class(es) are to be used as source + * for annotations to mix in for given type. + * + * @return List of mix-in sources (starting with highest priority); + * can be null or empty list if no mix-ins are to be used. + */ + public List> mixInsFor(Class beanClass) { + return mixInsFor(new ClassKey(beanClass)); + } + + public abstract List> mixInsFor(ClassKey beanClass); + + /** + * Method for constructing builder for creating simple overrides provider + * that just uses direct assignments (target-to-override classes) + */ + public static StdBuilder builder() { + return new StdBuilder(); + } + + /* + /********************************************************************** + /* Helper types + /********************************************************************** + */ + + /** + * To make it easy to use simple override implementation (where overrides + * are direct and explicit), here is a build that allow constructing + * such override instance. + */ + public static class StdBuilder + { + protected final HashMap>> _targetsToOverrides = new HashMap>>(); + + public StdBuilder() { } + + public StdBuilder add(Class target, Class mixin) { + return add(new ClassKey(target), mixin); + } + + public StdBuilder add(ClassKey target, Class mixin) + { + List> mixins = _targetsToOverrides.get(target); + if (mixins == null) { + mixins = new ArrayList>(); + _targetsToOverrides.put(target, mixins); + } + mixins.add(mixin); + return this; + } + + /** + * Method that will construct a {@link AnnotationOverrides} instance using + * mappings that have been added using this builder + */ + public AnnotationOverrides build() { + return new StdImpl(_targetsToOverrides); + } + } + + /** + * Simple implementation configured with explicit associations with + * target class as key, and overrides as ordered list of classes + * (with first entry having precedence over later ones). + */ + public static class StdImpl extends AnnotationOverrides + { + protected final HashMap>> _targetsToOverrides; + + public StdImpl(HashMap>> overrides) { + _targetsToOverrides = new HashMap>>(overrides); + } + + @Override + public List> mixInsFor(ClassKey target) { + return _targetsToOverrides.get(target); + } + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/Annotations.java b/fine-classmate/src/com/fasterxml/classmate/Annotations.java new file mode 100644 index 000000000..db8020d47 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/Annotations.java @@ -0,0 +1,132 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; +import java.lang.annotation.Annotation; +import java.util.*; + +/** + * Container class used for storing set of annotations resolved for types (classes) + * as members (methods, fields, constructors). + * + * @author tatu + */ +@SuppressWarnings("serial") +public class Annotations implements Serializable, Iterable +{ + private final Annotation[] NO_ANNOTATIONS = new Annotation[0]; + + protected LinkedHashMap,Annotation> _annotations; + + /* + /********************************************************************** + /* Life-cycle + /********************************************************************** + */ + + public Annotations() { } + + /** + * Method for adding specified annotation, overriding existing value + * for the annotation type. + */ + public void add(Annotation override) + { + if (_annotations == null) { + _annotations = new LinkedHashMap,Annotation>(); + } + _annotations.put(override.annotationType(), override); + } + + /** + * Method for adding all annotations from specified set, as overrides + * to annotations this set has + */ + public void addAll(Annotations overrides) + { + if (_annotations == null) { + _annotations = new LinkedHashMap,Annotation>(); + } + for (Annotation override : overrides._annotations.values()) { + _annotations.put(override.annotationType(), override); + } + } + + /** + * Method for adding specified annotation if and only if no value + * exists for the annotation type. + */ + public void addAsDefault(Annotation defValue) + { + Class type = defValue.annotationType(); + if (_annotations == null) { + _annotations = new LinkedHashMap,Annotation>(); + _annotations.put(type, defValue); + } else if (!_annotations.containsKey(type)) { + _annotations.put(type, defValue); + } + } + + /* + /********************************************************************** + /* Accessors + /********************************************************************** + */ + + @Override + public Iterator iterator() + { + if (_annotations == null) { + _annotations = new LinkedHashMap,Annotation>(); + } + return _annotations.values().iterator(); + } + + public int size() { + return (_annotations == null) ? 0 : _annotations.size(); + } + + @SuppressWarnings("unchecked") + public A get(Class cls) + { + if (_annotations == null) { + return null; + } + return (A) _annotations.get(cls); + } + + /** + * @since 1.1.1 + */ + public Annotation[] asArray() { + if (_annotations == null || _annotations.isEmpty()) { + return NO_ANNOTATIONS; + } + return _annotations.values().toArray(new Annotation[_annotations.size()]); + } + + /** + * @since 1.1.1 + */ + public List asList() { + if (_annotations == null || _annotations.isEmpty()) { + return Collections.emptyList(); + } + List l = new ArrayList(_annotations.size()); + l.addAll(_annotations.values()); + return l; + } + + /* + /********************************************************************** + /* Standard method overrides + /********************************************************************** + */ + + @Override public String toString() + { + if (_annotations == null) { + return "[null]"; + } + return _annotations.toString(); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/Filter.java b/fine-classmate/src/com/fasterxml/classmate/Filter.java new file mode 100644 index 000000000..3617ba8d3 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/Filter.java @@ -0,0 +1,10 @@ +package com.fasterxml.classmate; + +/** + * Interface that defines API for basic filtering objects, used to prune set + * of things to include in result sets like flattened member lists. + */ +public interface Filter +{ + public boolean include(T element); +} diff --git a/fine-classmate/src/com/fasterxml/classmate/GenericType.java b/fine-classmate/src/com/fasterxml/classmate/GenericType.java new file mode 100644 index 000000000..be7bad437 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/GenericType.java @@ -0,0 +1,25 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; + +/** + * This class is used to pass full generics type information, and + * avoid problems with type erasure (that basically removes most + * usable type references from runtime Class objects). + * It is based on ideas from + * http://gafter.blogspot.com/2006/12/super-type-tokens.html, + *

+ * Usage is by sub-classing: here is one way to instantiate reference + * to generic type List<Integer>: + *

+ *  GenericType type = new GenericType<List<Integer>>() { };
+ *
+ * which can be passed to methods that accept GenericReference. + */ +@SuppressWarnings("serial") +public abstract class GenericType + implements Serializable, java.lang.reflect.Type +{ + protected GenericType() { } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/MemberResolver.java b/fine-classmate/src/com/fasterxml/classmate/MemberResolver.java new file mode 100644 index 000000000..5579a87c2 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/MemberResolver.java @@ -0,0 +1,235 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; +import java.util.*; + +import com.fasterxml.classmate.members.*; +import com.fasterxml.classmate.util.ClassKey; + +/** + * Builder class used to completely resolve members (fields, methods, + * constructors) of {@link ResolvedType}s (generics-aware classes). + */ +@SuppressWarnings("serial") +public class MemberResolver implements Serializable +{ + + /** + * Type resolved needed for resolving types of member objects + * (method argument and return; field types; constructor argument types) + */ + protected final TypeResolver _typeResolver; + + /* + /********************************************************************** + /* Modifiable configuration + /********************************************************************** + */ + + /** + * Configuration setting that determines whether members from + * {@link java.lang.Object} are included or not; by default + * false meaning that they are not. + */ + protected boolean _cfgIncludeLangObject; + + /** + * Filter used for determining whether given + * field (static or member) + * is to be included in aggregation of all + * fields. + */ + protected Filter _fieldFilter; + + /** + * Filter used for determining whether given + * method (static or member) + * is to be included in aggregation of all + * methods. + */ + protected Filter _methodFilter; + + /** + * Filter used for determining whether given + * constructor + * is to be included in aggregation of all + * constructors. + */ + protected Filter _constructorFilter; + + /* + /********************************************************************** + /* Life cycle (construct and config) + /********************************************************************** + */ + + /** + * Constructor for resolver that does not include java.lang.Object + * in type hierarchy + */ + public MemberResolver(TypeResolver typeResolver) + { + _typeResolver = typeResolver; + } + + /** + * Configuration method for specifying whether members of java.lang.Object + * are to be included in resolution; if false, no members from {@link java.lang.Object} + * are to be included; if true, will be included. + */ + public MemberResolver setIncludeLangObject(boolean state) { + _cfgIncludeLangObject = state; + return this; + } + + public MemberResolver setFieldFilter(Filter f) { + _fieldFilter = f; + return this; + } + + public MemberResolver setMethodFilter(Filter f) { + _methodFilter = f; + return this; + } + + public MemberResolver setConstructorFilter(Filter f) { + _constructorFilter = f; + return this; + } + + /* + /********************************************************************** + /* Public API + /********************************************************************** + */ + + /** + * Method for constructing hierarchy object needed to fully resolve + * member information, including basic type flattening as well as + * addition of mix-in types in appropriate positions. + * + * @param mainType Resolved type that is the starting point (i.e. the leaf class) + * for member resolution. + * @param annotationConfig Configuration of annotation types; which ones to include, how to inherit + * @param annotationOverrides Definitions of annotation overrides to use, if any (may be null) + */ + public ResolvedTypeWithMembers resolve(final ResolvedType mainType, + AnnotationConfiguration annotationConfig, + AnnotationOverrides annotationOverrides) + { + // First: flatten basic type hierarchy (highest to lowest precedence) + HashSet seenTypes = new HashSet(); + ArrayList types = new ArrayList(); + _gatherTypes(mainType, seenTypes, types); + + // Second step: inject mix-ins (keeping order from highest to lowest) + HierarchicType[] htypes; + HierarchicType mainHierarchicType = null; + + // Third step: add mix-ins (if any), reverse order (lowest to highest precedence) + if (annotationOverrides == null) { // just create hierarchic instances: + int len = types.size(); + htypes = new HierarchicType[len]; + for (int i = 0; i < len; ++i) { + // false -> not a mix-in + htypes[i] = new HierarchicType(types.get(i), false, i); + } + mainHierarchicType = htypes[0]; + } else { // need to add mix-ins, reorder + ArrayList typesWithMixins = new ArrayList(); + for (ResolvedType type : types) { + // First add mix-ins (which override type itself) + List> m = annotationOverrides.mixInsFor(type.getErasedType()); + if (m != null) { + for (Class mixinClass : m) { + _addOverrides(typesWithMixins, seenTypes, mixinClass); + } + } + + // Then actual type: + HierarchicType ht = new HierarchicType(type, false, typesWithMixins.size()); + if (mainHierarchicType == null) { + mainHierarchicType = ht; + } + typesWithMixins.add(ht); + } + htypes = typesWithMixins.toArray(new HierarchicType[typesWithMixins.size()]); + } + // And that's about all we need to do; rest computed lazily + return new ResolvedTypeWithMembers(_typeResolver, annotationConfig, mainHierarchicType, htypes, + _constructorFilter, _fieldFilter, _methodFilter); + } + + private void _addOverrides(List typesWithOverrides, Set seenTypes, Class override) + { + ClassKey key = new ClassKey(override); + if (!seenTypes.contains(key)) { + seenTypes.add(key); + ResolvedType resolvedOverride = _typeResolver.resolve(override); + typesWithOverrides.add(new HierarchicType(resolvedOverride, true, typesWithOverrides.size())); + for (ResolvedType r : resolvedOverride.getImplementedInterfaces()) { // interfaces? + _addOverrides(typesWithOverrides, seenTypes, r); + } + ResolvedType superClass = resolvedOverride.getParentClass(); + _addOverrides(typesWithOverrides, seenTypes, superClass); + } + } + + private void _addOverrides(List typesWithOverrides, Set seenTypes, ResolvedType override) + { + if (override == null) return; + // first: may need to exclude Object.class: + Class raw = override.getErasedType(); + if (!_cfgIncludeLangObject && Object.class == raw) return; + ClassKey key = new ClassKey(raw); + if (!seenTypes.contains(key)) { + seenTypes.add(key); + typesWithOverrides.add(new HierarchicType(override, true, typesWithOverrides.size())); + for (ResolvedType r : override.getImplementedInterfaces()) { // interfaces? + _addOverrides(typesWithOverrides, seenTypes, r); + } + ResolvedType superClass = override.getParentClass(); + if (superClass != null) { + _addOverrides(typesWithOverrides, seenTypes, superClass); + } + } + } + + /* + /********************************************************************** + /* Internal methods + /********************************************************************** + */ + + protected void _gatherTypes(ResolvedType currentType, Set seenTypes, List types) + { + // may get called with null if no parent type + if (currentType == null) { + return; + } + Class raw = currentType.getErasedType(); + // Also, don't include Object.class unless that's ok + if (!_cfgIncludeLangObject && raw == Object.class) { + return; + } + // Finally, only include first instance of an interface, so: + ClassKey key = new ClassKey(currentType.getErasedType()); + if (seenTypes.contains(key)) { + return; + } + // If all good so far, append + seenTypes.add(key); + types.add(currentType); + /* and check supertypes; starting with interfaces. Why interfaces? + * So that "highest" interfaces get priority; otherwise we'd recurse + * super-class stack and actually start with the bottom. Usually makes + * little difference, but in cases where it does this seems like the + * correct order. + */ + for (ResolvedType t : currentType.getImplementedInterfaces()) { + _gatherTypes(t, seenTypes, types); + } + // and then superclass + _gatherTypes(currentType.getParentClass(), seenTypes, types); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/ResolvedType.java b/fine-classmate/src/com/fasterxml/classmate/ResolvedType.java new file mode 100644 index 000000000..5ca02c94b --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/ResolvedType.java @@ -0,0 +1,399 @@ +package com.fasterxml.classmate; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Type; +import java.util.*; + +import com.fasterxml.classmate.members.*; + +public abstract class ResolvedType + implements Type +{ + public final static ResolvedType[] NO_TYPES = new ResolvedType[0]; + + protected final static RawConstructor[] NO_CONSTRUCTORS = new RawConstructor[0]; + protected final static RawField[] NO_FIELDS = new RawField[0]; + protected final static RawMethod[] NO_METHODS = new RawMethod[0]; + + protected final Class _erasedType; + + /** + * Type bindings active when resolving members (methods, fields, + * constructors) of this type + */ + protected final TypeBindings _typeBindings; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + protected ResolvedType(Class cls, TypeBindings bindings) + { + _erasedType = cls; + _typeBindings = (bindings == null) ? TypeBindings.emptyBindings() : bindings; + } + + /** + * Method that can be used to check if call to {@link TypeResolver#resolveSubtype(ResolvedType, Class)} + * may ever succeed; if false, it will fail with an exception, if true, it may succeed. + */ + public abstract boolean canCreateSubtypes(); + + /** + * Method that can be used to check if call to {@link TypeResolver#resolveSubtype(ResolvedType, Class)} + * will succeed for specific type; if false, it will fail with an exception; if tru it + * will succeed. + */ + public final boolean canCreateSubtype(Class subtype) { + return canCreateSubtypes() && _erasedType.isAssignableFrom(subtype); + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + /** + * Returns type-erased Class that this resolved type has. + */ + public Class getErasedType() { return _erasedType; } + + /** + * Returns parent class of this type, if it has one; primitive types + * and interfaces have no parent class, nor does Object type + * {@link java.lang.Object}. + * Also, placeholders for cyclic (recursive) types return null for + * this method. + */ + public abstract ResolvedType getParentClass(); + + /** + * Accessor that must be used to find out actual type in + * case of "self-reference"; case where type refers + * recursive to itself (like, T implements Comparable<T>). + * For all other types returns null but for self-references "real" type. + * Separate accessor is provided to avoid accidental infinite loops. + */ + public abstract ResolvedType getSelfReferencedType(); + + /** + * Method that can be used to access element type of array types; will return + * null for non-array types, and non-null type for array types. + */ + public abstract ResolvedType getArrayElementType(); + + /** + * Returns ordered list of interfaces (in declaration order) that this type + * implements. + * + * @return List of interfaces this type implements, if any; empty list if none + */ + public abstract List getImplementedInterfaces(); + + /** + * Returns list of generic type declarations for this type, in order they + * are declared in class description. + */ + public List getTypeParameters() { + return _typeBindings.getTypeParameters(); + } + + /** + * Method for accessing bindings of type variables to resolved types in context + * of this type. It has same number of entries as return List of + * {@link #getTypeParameters}, accessible using declared name to which they + * bind; for example, {@link java.util.Map} has 2 type bindings; one for + * key type (name "K", from Map.java) and one for value type + * (name "V", from Map.java). + */ + public TypeBindings getTypeBindings() { return _typeBindings; } + + /** + * Method that will try to find type parameterization this type + * has for specified super type + * + * @return List of type parameters for specified supertype (which may + * be empty, if supertype is not a parametric type); null if specified + * type is not a super type of this type + */ + public List typeParametersFor(Class erasedSupertype) + { + ResolvedType type = findSupertype(erasedSupertype); + if (type != null) { + return type.getTypeParameters(); + } + // nope; doesn't look like we extend or implement super type in question + return null; + } + + /** + * Method for finding super type of this type that has specified type + * erased signature. If supertype is an interface which is implemented + * using multiple inheritance paths, preference is given to interfaces + * implemented "highest up the stack" (directly implemented interfaces + * over interfaces superclass implements). + */ + public ResolvedType findSupertype(Class erasedSupertype) + { + if (erasedSupertype == _erasedType) { + return this; + } + // Check super interfaces first: + if (erasedSupertype.isInterface()) { + for (ResolvedType it : getImplementedInterfaces()) { + ResolvedType type = it.findSupertype(erasedSupertype); + if (type != null) { + return type; + } + } + } + // and if not found, super class and its supertypes + ResolvedType pc = getParentClass(); + if (pc != null) { + ResolvedType type = pc.findSupertype(erasedSupertype); + if (type != null) { + return type; + } + } + // nope; doesn't look like we extend or implement super type in question + return null; + } + + /* + /********************************************************************** + /* Accessors for simple properties + /********************************************************************** + */ + + public abstract boolean isInterface(); + public final boolean isConcrete() { return !isAbstract(); } + public abstract boolean isAbstract(); + + /** + * Method that indicates whether this type is an array type. + */ + public abstract boolean isArray(); + + /** + * Method that indicates whether this type is one of small number of primitive + * Java types; not including array types of primitive types but just basic + * primitive types. + */ + public abstract boolean isPrimitive(); + + public final boolean isInstanceOf(Class type) { + return type.isAssignableFrom(_erasedType); + } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + public List getConstructors() { return Collections.emptyList(); } + public List getMemberFields() { return Collections.emptyList(); } + public List getMemberMethods() { return Collections.emptyList(); } + public List getStaticFields() { return Collections.emptyList(); } + public List getStaticMethods() { return Collections.emptyList(); } + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + /** + * Method that returns full generic signature of the type; suitable + * as signature for things like ASM package. + */ + public String getSignature() { + StringBuilder sb = new StringBuilder(); + return appendSignature(sb).toString(); + } + + /** + * Method that returns type erased signature of the type; suitable + * as non-generic signature some packages need + */ + public String getErasedSignature() { + StringBuilder sb = new StringBuilder(); + return appendErasedSignature(sb).toString(); + } + + /** + * Human-readable full description of type, which includes specification + * of super types (in brief format) + */ + public String getFullDescription() { + StringBuilder sb = new StringBuilder(); + return appendFullDescription(sb).toString(); + } + + /** + * Human-readable brief description of type, which does not include + * information about super types. + */ + public String getBriefDescription() { + StringBuilder sb = new StringBuilder(); + return appendBriefDescription(sb).toString(); + } + + public abstract StringBuilder appendBriefDescription(StringBuilder sb); + public abstract StringBuilder appendFullDescription(StringBuilder sb); + public abstract StringBuilder appendSignature(StringBuilder sb); + public abstract StringBuilder appendErasedSignature(StringBuilder sb); + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public String toString() { + return getBriefDescription(); + } + + @Override public int hashCode() { + return _erasedType.getName().hashCode() + _typeBindings.hashCode(); + } + + @Override public boolean equals(Object o) + { + if (o == this) return true; + // sub-types must be same: + if (o == null || o.getClass() != getClass()) return false; + // Should be possible to actually implement here... + ResolvedType other = (ResolvedType) o; + if (other._erasedType != _erasedType) { + return false; + } + // and type bindings must match as well + return _typeBindings.equals(other._typeBindings); + } + + /* + /********************************************************************** + /* Helper methods for sub-classes; string construction + /********************************************************************** + */ + + protected StringBuilder _appendClassSignature(StringBuilder sb) + { + sb.append('L'); + sb = _appendClassName(sb); + int count = _typeBindings.size(); + if (count > 0) { + sb.append('<'); + for (int i = 0; i < count; ++i) { + sb = _typeBindings.getBoundType(i).appendErasedSignature(sb); + } + sb.append('>'); + } + sb.append(';'); + return sb; + } + + protected StringBuilder _appendErasedClassSignature(StringBuilder sb) + { + sb.append('L'); + sb = _appendClassName(sb); + sb.append(';'); + return sb; + } + + protected StringBuilder _appendClassDescription(StringBuilder sb) + { + sb.append(_erasedType.getName()); + int count = _typeBindings.size(); + if (count > 0) { + sb.append('<'); + for (int i = 0; i < count; ++i) { + if (i > 0) { + sb.append(','); + } + sb = _typeBindings.getBoundType(i).appendBriefDescription(sb); + } + sb.append('>'); + } + return sb; + } + + protected StringBuilder _appendClassName(StringBuilder sb) + { + String name = _erasedType.getName(); + for (int i = 0, len = name.length(); i < len; ++i) { + char c = name.charAt(i); + if (c == '.') c = '/'; + sb.append(c); + } + return sb; + } + + /* + /********************************************************************** + /* Helper methods for sub-classes; gathering members + /********************************************************************** + */ + + /** + * @param statics Whether to return static methods (true) or member methods (false) + */ + protected RawField[] _getFields(boolean statics) + { + ArrayList fields = new ArrayList(); + for (Field f : _erasedType.getDeclaredFields()) { + // Only skip synthetic fields, which should not really be exposed + if (!f.isSynthetic()) { + if (Modifier.isStatic(f.getModifiers()) == statics) { + fields.add(new RawField(this, f)); + } + } + } + if (fields.isEmpty()) { + return NO_FIELDS; + } + return fields.toArray(new RawField[fields.size()]); + } + + /** + * @param statics Whether to return static methods (true) or member methods (false) + */ + protected RawMethod[] _getMethods(boolean statics) + { + ArrayList methods = new ArrayList(); + for (Method m : _erasedType.getDeclaredMethods()) { + // Only skip synthetic fields, which should not really be exposed + if (!m.isSynthetic()) { + if (Modifier.isStatic(m.getModifiers()) == statics) { + methods.add(new RawMethod(this, m)); + } + } + } + if (methods.isEmpty()) { + return NO_METHODS; + } + return methods.toArray(new RawMethod[methods.size()]); + } + + protected RawConstructor[] _getConstructors() + { + ArrayList ctors = new ArrayList(); + for (Constructor c : _erasedType.getDeclaredConstructors()) { + // Only skip synthetic fields, which should not really be exposed + if (!c.isSynthetic()) { + ctors.add(new RawConstructor(this, c)); + } + } + if (ctors.isEmpty()) { + return NO_CONSTRUCTORS; + } + return ctors.toArray(new RawConstructor[ctors.size()]); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/ResolvedTypeWithMembers.java b/fine-classmate/src/com/fasterxml/classmate/ResolvedTypeWithMembers.java new file mode 100644 index 000000000..15cb61f23 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/ResolvedTypeWithMembers.java @@ -0,0 +1,715 @@ +package com.fasterxml.classmate; + +import java.lang.annotation.Annotation; +import java.lang.annotation.Inherited; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.util.*; + +import com.fasterxml.classmate.members.*; +import com.fasterxml.classmate.util.MethodKey; + +/** + * Class that contains information about fully resolved members of a + * type; resolution meaning that masking is handled for methods, and + * all inheritable annotations are flattened using optional overrides + * as well ("mix-in annotations"). + * Instances are created by {@link com.fasterxml.classmate.MemberResolver}. + *

+ * Note that instances are not thread-safe, as the expectation is that instances + * will not be shared (unlike raw members or resolved types) + */ +public class ResolvedTypeWithMembers +{ + private final static ResolvedType[] NO_RESOLVED_TYPES = new ResolvedType[0]; + + private final static ResolvedMethod[] NO_RESOLVED_METHODS = new ResolvedMethod[0]; + private final static ResolvedField[] NO_RESOLVED_FIELDS = new ResolvedField[0]; + private final static ResolvedConstructor[] NO_RESOLVED_CONSTRUCTORS = new ResolvedConstructor[0]; + + /** + * Default annotation configuration is to ignore all annotations types. + */ + protected final static AnnotationConfiguration DEFAULT_ANNOTATION_CONFIG + = new AnnotationConfiguration.StdConfiguration(AnnotationInclusion.DONT_INCLUDE); + + /** + * Need to be able to resolve member types still + */ + protected final TypeResolver _typeResolver; + + /** + * Handler for resolving annotation information + */ + protected final AnnotationHandler _annotationHandler; + + /** + * Leaf of the type hierarchy, i.e. type from which this hierarchy + * was generated. + */ + protected final HierarchicType _mainType; + + /** + * All types that hierarchy contains, in order of increasing precedence + * (that is, later entries override members of earlier members) + */ + protected final HierarchicType[] _types; + + /** + * Filter to use for selecting fields to include + */ + protected Filter _fieldFilter; + + /** + * Filter to use for selecting constructors to include + */ + protected Filter _constructorFilter; + + /** + * Filter to use for selecting methods to include + */ + protected Filter _methodFilter; + + /* + /********************************************************************** + /* Lazily constructed members + /********************************************************************** + */ + + protected ResolvedMethod[] _staticMethods = null; + + protected ResolvedField[] _staticFields = null; + + protected ResolvedMethod[] _memberMethods = null; + + protected ResolvedField[] _memberFields = null; + + protected ResolvedConstructor[] _constructors = null; + + /* + /********************************************************************** + /* Life cycle at this point + /********************************************************************** + */ + + public ResolvedTypeWithMembers(TypeResolver typeResolver, AnnotationConfiguration annotationConfig, + HierarchicType mainType, HierarchicType[] types, + Filter constructorFilter, Filter fieldFilter, Filter methodFilter) + { + _typeResolver = typeResolver; + _mainType = mainType; + _types = types; + if (annotationConfig == null) { + annotationConfig = DEFAULT_ANNOTATION_CONFIG; + } + _annotationHandler = new AnnotationHandler(annotationConfig); + _constructorFilter = constructorFilter; + _fieldFilter = fieldFilter; + _methodFilter = methodFilter; + } + + /* + /********************************************************************** + /* Public API, access to component types + /********************************************************************** + */ + + public int size() { return _types.length; } + + /** + * Accessor for getting full type hierarchy as priority-ordered list, from + * the lowest precedence to highest precedence (main type, its mix-in overrides) + */ + public List allTypesAndOverrides() { + return Arrays.asList(_types); + } + + /** + * Accessor for getting subset of type hierarchy which only contains main type + * and possible overrides (mix-ins) it has, but not supertypes or their overrides. + */ + public List mainTypeAndOverrides() + { + List l = Arrays.asList(_types); + int end = _mainType.getPriority() + 1; + if (end < l.size()) { + l = l.subList(0, end); + } + return l; + } + + /** + * Accessor for finding just overrides for the main type (if any). + */ + public List overridesOnly() + { + int index = _mainType.getPriority(); + if (index == 0) { + return Collections.emptyList(); + } + List l = Arrays.asList(_types); + return l.subList(0, index); + } + + /* + /********************************************************************** + /* Public API, actual resolution of members + /********************************************************************** + */ + + /** + * Method for finding all static fields of the main type (except for ones + * possibly filtered out by filter) and applying annotation overrides, if any, + * to annotations. + * + * @since 1.2.0 + */ + public ResolvedField[] getStaticFields() + { + if (_staticFields == null) { + _staticFields = resolveStaticFields(); + } + return _staticFields; + } + + /** + * Method for finding all static methods of the main type (except for ones + * possibly filtered out by filter) and applying annotation overrides, if any, + * to annotations. + */ + public ResolvedMethod[] getStaticMethods() + { + if (_staticMethods == null) { + _staticMethods = resolveStaticMethods(); + } + return _staticMethods; + } + + public ResolvedField[] getMemberFields() + { + if (_memberFields == null) { + _memberFields = resolveMemberFields(); + } + return _memberFields; + } + + public ResolvedMethod[] getMemberMethods() + { + if (_memberMethods == null) { + _memberMethods = resolveMemberMethods(); + } + return _memberMethods; + } + + public ResolvedConstructor[] getConstructors() + { + if (_constructors == null) { + _constructors = resolveConstructors(); + } + return _constructors; + } + + /* + /********************************************************************** + /* Internal methods: actual resolution + /********************************************************************** + */ + + /** + * Method that will actually resolve full information (types, annotations) + * for constructors of the main type. + */ + protected ResolvedConstructor[] resolveConstructors() + { + // First get static methods for main type, filter + LinkedHashMap constructors = new LinkedHashMap(); + for (RawConstructor constructor : _mainType.getType().getConstructors()) { + // no filter for constructors (yet?) + if (_constructorFilter == null || _constructorFilter.include(constructor)) { + constructors.put(constructor.createKey(), resolveConstructor(constructor)); + } + } + // then apply overrides (mix-ins): + for (HierarchicType type : overridesOnly()) { + for (RawConstructor raw : type.getType().getConstructors()) { + ResolvedConstructor constructor = constructors.get(raw.createKey()); + // must override something, otherwise to ignore + if (constructor != null) { + for (Annotation ann : raw.getAnnotations()) { + if (_annotationHandler.includeMethodAnnotation(ann)) { + constructor.applyOverride(ann); + } + } + + // and parameter annotations + Annotation[][] params = raw.getRawMember().getParameterAnnotations(); + for (int i = 0; i < params.length; i++) { + for (Annotation annotation : params[i]) { + if (_annotationHandler.includeParameterAnnotation(annotation)) { + constructor.applyParamOverride(i, annotation); + } + } + } + } + } + } + if (constructors.size() == 0) { + return NO_RESOLVED_CONSTRUCTORS; + } + return constructors.values().toArray(new ResolvedConstructor[constructors.size()]); + } + + /** + * Method for fully resolving field definitions and associated annotations. + * Neither field definitions nor associated annotations inherit, but we may + * still need to add annotation overrides, as well as filter out filters + * and annotations that caller is not interested in. + */ + protected ResolvedField[] resolveMemberFields() + { + LinkedHashMap fields = new LinkedHashMap(); + + /* Fields need different handling: must start from bottom; and annotations only get added + * as overrides, never as defaults. And sub-classes fully mask fields. This makes + * handling bit simpler than that of member methods. + */ + for (int typeIndex = _types.length; --typeIndex >= 0; ) { + HierarchicType thisType = _types[typeIndex]; + // If it's just a mix-in, add annotations as overrides + if (thisType.isMixin()) { + for (RawField raw : thisType.getType().getMemberFields()) { + if ((_fieldFilter != null) && !_fieldFilter.include(raw)) { + continue; + } + ResolvedField field = fields.get(raw.getName()); + if (field != null) { + for (Annotation ann : raw.getAnnotations()) { + if (_annotationHandler.includeMethodAnnotation(ann)) { + field.applyOverride(ann); + } + } + } + } + } else { // If actual type, add fields, masking whatever might have existed before: + for (RawField field : thisType.getType().getMemberFields()) { + if ((_fieldFilter != null) && !_fieldFilter.include(field)) { + continue; + } + fields.put(field.getName(), resolveField(field)); + } + } + } + // and that's it? + if (fields.size() == 0) { + return NO_RESOLVED_FIELDS; + } + return fields.values().toArray(new ResolvedField[fields.size()]); + } + + protected ResolvedMethod[] resolveMemberMethods() + { + LinkedHashMap methods = new LinkedHashMap(); + LinkedHashMap overrides = new LinkedHashMap(); + LinkedHashMap paramOverrides = new LinkedHashMap(); + + /* Member methods are handled from top to bottom; and annotations are tracked + * alongside (for overrides), as well as "merged down" for inheritable + * annotations. + */ + for (HierarchicType type : allTypesAndOverrides()) { + for (RawMethod method : type.getType().getMemberMethods()) { + // First: ignore methods caller is not interested + if (_methodFilter != null && !_methodFilter.include(method)) { + continue; + } + + MethodKey key = method.createKey(); + ResolvedMethod old = methods.get(key); + + // Ok, now, mix-ins only contribute annotations; whereas 'real' types methods + if (type.isMixin()) { // mix-in: only get annotations + for (Annotation ann : method.getAnnotations()) { + // If already have a method, must be inheritable to include + if (old != null) { + if (!methodCanInherit(ann)) { + continue; + } + // and if so, apply as default (i.e. do not override) + old.applyDefault(ann); + } else { // If no method, need to add to annotation override map + Annotations oldAnn = overrides.get(key); + if (oldAnn == null) { + oldAnn = new Annotations(); + oldAnn.add(ann); + overrides.put(key, oldAnn); + } else { + oldAnn.addAsDefault(ann); + } + } + } + + // override argument annotations + final Annotation[][] argAnnotations = method.getRawMember().getParameterAnnotations(); + if (old == null) { // no method (yet), add argument annotations to override map + Annotations[] oldParamAnns = paramOverrides.get(key); + if (oldParamAnns == null) { // no existing argument annotations for method + oldParamAnns = new Annotations[argAnnotations.length]; + for (int i = 0; i < argAnnotations.length; i++) { + oldParamAnns[i] = new Annotations(); + for (final Annotation annotation : argAnnotations[i]) { + if (parameterCanInherit(annotation)) { + oldParamAnns[i].add(annotation); + } + } + } + paramOverrides.put(key, oldParamAnns); + } else { + for (int i = 0; i < argAnnotations.length; i++) { + for (final Annotation annotation : argAnnotations[i]) { + if (parameterCanInherit(annotation)) { + oldParamAnns[i].addAsDefault(annotation); + } + } + } + } + } else { // already have a method, apply argument annotations as defaults + for (int i = 0; i < argAnnotations.length; i++) { + for (final Annotation annotation : argAnnotations[i]) { + if (parameterCanInherit(annotation)) { + old.applyParamDefault(i, annotation); + } + } + } + } + } else { // "real" methods; add if not present, possibly add defaults as well + if (old == null) { // new one to add + ResolvedMethod newMethod = resolveMethod(method); + methods.put(key, newMethod); + // But we may also have annotation overrides, so: + Annotations overrideAnn = overrides.get(key); + if (overrideAnn != null) { + newMethod.applyOverrides(overrideAnn); + } + // and apply parameter annotation overrides + Annotations[] annotations = paramOverrides.get(key); + if (annotations != null) { + for (int i = 0; i < annotations.length; i++) { + newMethod.applyParamOverrides(i, annotations[i]); + } + } + } else { // method masked by something else? can only contribute annotations + for (Annotation ann : method.getAnnotations()) { + if (methodCanInherit(ann)) { + old.applyDefault(ann); + } + } + // and parameter annotations + final Annotation[][] parameterAnnotations = method.getRawMember().getParameterAnnotations(); + for (int i = 0; i < parameterAnnotations.length; i++) { + for (final Annotation annotation : parameterAnnotations[i]) { + if (parameterCanInherit(annotation)) { + old.applyParamDefault(i, annotation); + } + } + } + } + } + } + } + + if (methods.size() == 0) { + return NO_RESOLVED_METHODS; + } + return methods.values().toArray(new ResolvedMethod[methods.size()]); + } + + /** + * Method for fully resolving static field definitions and associated annotations. + * Neither field definitions nor associated annotations inherit, but we may + * still need to add annotation overrides, as well as filter out filters + * and annotations that caller is not interested in. + * + * @since 1.2.0 + */ + protected ResolvedField[] resolveStaticFields() + { + // First get static methods for main type, filter + LinkedHashMap fields = new LinkedHashMap(); + for (RawField field : _mainType.getType().getStaticFields()) { + if (_fieldFilter == null || _fieldFilter.include(field)) { + fields.put(field.getName(), resolveField(field)); + } + } + // then apply overrides (mix-ins): + for (HierarchicType type : overridesOnly()) { + for (RawField raw : type.getType().getStaticFields()) { + ResolvedField field = fields.get(raw.getName()); + // must override something, otherwise to ignore + if (field != null) { + for (Annotation ann : raw.getAnnotations()) { + if (_annotationHandler.includeFieldAnnotation(ann)) { + field.applyOverride(ann); + } + } + } + } + } + // and that's it? + if (fields.isEmpty()) { + return NO_RESOLVED_FIELDS; + } + return fields.values().toArray(new ResolvedField[ fields.size()]); + } + + /** + * Method that will actually resolve full information (types, annotations) + * for static methods, using configured filter. + */ + protected ResolvedMethod[] resolveStaticMethods() + { + // First get static methods for main type, filter + LinkedHashMap methods = new LinkedHashMap(); + for (RawMethod method : _mainType.getType().getStaticMethods()) { + if (_methodFilter == null || _methodFilter.include(method)) { + methods.put(method.createKey(), resolveMethod(method)); + } + } + // then apply overrides (mix-ins): + for (HierarchicType type : overridesOnly()) { + for (RawMethod raw : type.getType().getStaticMethods()) { + ResolvedMethod method = methods.get(raw.createKey()); + // must override something, otherwise to ignore + if (method != null) { + for (Annotation ann : raw.getAnnotations()) { + if (_annotationHandler.includeMethodAnnotation(ann)) { + method.applyOverride(ann); + } + } + } + } + } + if (methods.size() == 0) { + return NO_RESOLVED_METHODS; + } + return methods.values().toArray(new ResolvedMethod[methods.size()]); + } + + /* + /********************************************************************** + /* Helper methods + /********************************************************************** + */ + + /** + * Method for resolving individual constructor completely + */ + protected ResolvedConstructor resolveConstructor(RawConstructor raw) + { + final ResolvedType context = raw.getDeclaringType(); + final TypeBindings bindings = context.getTypeBindings(); + Constructor ctor = raw.getRawMember(); + Type[] rawTypes = ctor.getGenericParameterTypes(); + ResolvedType[] argTypes; + if (rawTypes == null || rawTypes.length == 0) { + argTypes = NO_RESOLVED_TYPES; + } else { + argTypes = new ResolvedType[rawTypes.length]; + for (int i = 0, len = rawTypes.length; i < len; ++i) { + argTypes[i] = _typeResolver.resolve(bindings, rawTypes[i]); + } + } + // And then annotations + Annotations anns = new Annotations(); + for (Annotation ann : ctor.getAnnotations()) { + if (_annotationHandler.includeConstructorAnnotation(ann)) { + anns.add(ann); + } + } + + ResolvedConstructor constructor = new ResolvedConstructor(context, anns, ctor, argTypes); + + // and parameter annotations + Annotation[][] annotations = ctor.getParameterAnnotations(); + for (int i = 0; i < argTypes.length; i++) { + for (Annotation ann : annotations[i]) { + constructor.applyParamOverride(i, ann); + } + } + + return constructor; + } + + /** + * Method for resolving individual field completely + */ + protected ResolvedField resolveField(RawField raw) + { + final ResolvedType context = raw.getDeclaringType(); + Field field = raw.getRawMember(); + ResolvedType type = _typeResolver.resolve(context.getTypeBindings(), field.getGenericType()); + // And then annotations + Annotations anns = new Annotations(); + for (Annotation ann : field.getAnnotations()) { + if (_annotationHandler.includeFieldAnnotation(ann)) { + anns.add(ann); + } + } + return new ResolvedField(context, anns, field, type); + } + + /** + * Method for resolving individual method completely + */ + protected ResolvedMethod resolveMethod(RawMethod raw) + { + final ResolvedType context = raw.getDeclaringType(); + final TypeBindings bindings = context.getTypeBindings(); + Method m = raw.getRawMember(); + Type rawType = m.getGenericReturnType(); + ResolvedType rt = (rawType == Void.TYPE) ? null : _typeResolver.resolve(bindings, rawType); + Type[] rawTypes = m.getGenericParameterTypes(); + ResolvedType[] argTypes; + if (rawTypes == null || rawTypes.length == 0) { + argTypes = NO_RESOLVED_TYPES; + } else { + argTypes = new ResolvedType[rawTypes.length]; + for (int i = 0, len = rawTypes.length; i < len; ++i) { + argTypes[i] = _typeResolver.resolve(bindings, rawTypes[i]); + } + } + // And then annotations + Annotations anns = new Annotations(); + for (Annotation ann : m.getAnnotations()) { + if (_annotationHandler.includeMethodAnnotation(ann)) { + anns.add(ann); + } + } + + ResolvedMethod method = new ResolvedMethod(context, anns, m, rt, argTypes); + + // and argument annotations + Annotation[][] annotations = m.getParameterAnnotations(); + for (int i = 0; i < argTypes.length; i++) { + for (Annotation ann : annotations[i]) { + method.applyParamOverride(i, ann); + } + } + return method; + } + + protected boolean methodCanInherit(Annotation annotation) { + AnnotationInclusion annotationInclusion = _annotationHandler.methodInclusion(annotation); + if (annotationInclusion == AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED) { + return annotation.annotationType().isAnnotationPresent(Inherited.class); + } + return (annotationInclusion == AnnotationInclusion.INCLUDE_AND_INHERIT); + } + + protected boolean parameterCanInherit(Annotation annotation) { + AnnotationInclusion annotationInclusion = _annotationHandler.parameterInclusion(annotation); + if (annotationInclusion == AnnotationInclusion.INCLUDE_AND_INHERIT_IF_INHERITED) { + return annotation.annotationType().isAnnotationPresent(Inherited.class); + } + return (annotationInclusion == AnnotationInclusion.INCLUDE_AND_INHERIT); + } + + /* + /********************************************************************** + /* Helper types + /********************************************************************** + */ + + /** + * Helper class we use to reduce number of calls to {@link AnnotationConfiguration}; + * mostly because determination may be expensive. + */ + private final static class AnnotationHandler + { + private final AnnotationConfiguration _annotationConfig; + + private HashMap, AnnotationInclusion> _fieldInclusions; + private HashMap, AnnotationInclusion> _constructorInclusions; + private HashMap, AnnotationInclusion> _methodInclusions; + private HashMap, AnnotationInclusion> _parameterInclusions; + + public AnnotationHandler(AnnotationConfiguration annotationConfig) { + _annotationConfig = annotationConfig; + } + + public boolean includeConstructorAnnotation(Annotation ann) + { + Class annType = ann.annotationType(); + if (_constructorInclusions == null) { + _constructorInclusions = new HashMap, AnnotationInclusion>(); + } else { + AnnotationInclusion incl = _constructorInclusions.get(annType); + if (incl != null) { + return (incl != AnnotationInclusion.DONT_INCLUDE); + } + } + AnnotationInclusion incl = _annotationConfig.getInclusionForConstructor(annType); + _constructorInclusions.put(annType, incl); + return (incl != AnnotationInclusion.DONT_INCLUDE); + } + + public boolean includeFieldAnnotation(Annotation ann) + { + Class annType = ann.annotationType(); + if (_fieldInclusions == null) { + _fieldInclusions = new HashMap, AnnotationInclusion>(); + } else { + AnnotationInclusion incl = _fieldInclusions.get(annType); + if (incl != null) { + return (incl != AnnotationInclusion.DONT_INCLUDE); + } + } + AnnotationInclusion incl = _annotationConfig.getInclusionForField(annType); + _fieldInclusions.put(annType, incl); + return (incl != AnnotationInclusion.DONT_INCLUDE); + } + + public boolean includeMethodAnnotation(Annotation ann) + { + return methodInclusion(ann) != AnnotationInclusion.DONT_INCLUDE; + } + + public AnnotationInclusion methodInclusion(Annotation ann) + { + Class annType = ann.annotationType(); + if (_methodInclusions == null) { + _methodInclusions = new HashMap, AnnotationInclusion>(); + } else { + AnnotationInclusion incl = _methodInclusions.get(annType); + if (incl != null) { + return incl; + } + } + AnnotationInclusion incl = _annotationConfig.getInclusionForMethod(annType); + _methodInclusions.put(annType, incl); + return incl; + } + + public boolean includeParameterAnnotation(Annotation ann) + { + return parameterInclusion(ann) != AnnotationInclusion.DONT_INCLUDE; + } + + public AnnotationInclusion parameterInclusion(Annotation ann) + { + Class annType = ann.annotationType(); + if (_parameterInclusions == null) { + _parameterInclusions = new HashMap, AnnotationInclusion>(); + } else { + AnnotationInclusion incl = _parameterInclusions.get(annType); + if (incl != null) { + return incl; + } + } + AnnotationInclusion incl = _annotationConfig.getInclusionForParameter(annType); + _parameterInclusions.put(annType, incl); + return incl; + } + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/TypeBindings.java b/fine-classmate/src/com/fasterxml/classmate/TypeBindings.java new file mode 100644 index 000000000..eda857928 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/TypeBindings.java @@ -0,0 +1,237 @@ +package com.fasterxml.classmate; + +import java.lang.reflect.TypeVariable; +import java.util.*; + +/** + * Helper class used for storing binding of local type variables to + * matching resolved types, in context of a single class. + */ +public final class TypeBindings +{ + private final static String[] NO_STRINGS = new String[0]; + + private final static ResolvedType[] NO_TYPES = new ResolvedType[0]; + + private final static TypeBindings EMPTY = new TypeBindings(NO_STRINGS, NO_TYPES, null); + + /** + * Array of type (type variable) names. + */ + private final String[] _names; + + /** + * Types matching names + */ + private final ResolvedType[] _types; + + /** + * Names of potentially unresolved type variables. + * + * @since 2.3 + */ + private final String[] _unboundVariables; + + private final int _hashCode; + + /* + /********************************************************************** + /* Construction + /********************************************************************** + */ + + private TypeBindings(String[] names, ResolvedType[] types, String[] uvars) + { + _names = (names == null) ? NO_STRINGS : names; + _types = (types == null) ? NO_TYPES : types; + if (_names.length != _types.length) { + throw new IllegalArgumentException("Mismatching names ("+_names.length+"), types ("+_types.length+")"); + } + int h = 1; + for (int i = 0, len = _types.length; i < len; ++i) { + h += _types[i].hashCode(); + } + _unboundVariables = uvars; + _hashCode = h; + } + + public static TypeBindings emptyBindings() { + return EMPTY; + } + + /** + * Factory method for constructing bindings for given class using specified type + * parameters. + */ + public static TypeBindings create(Class erasedType, List typeList) + { + ResolvedType[] types = (typeList == null || typeList.isEmpty()) ? + NO_TYPES : typeList.toArray(new ResolvedType[typeList.size()]); + return create(erasedType, types); + } + + public static TypeBindings create(Class erasedType, ResolvedType[] types) + { + if (types == null) { + types = NO_TYPES; + } + TypeVariable[] vars = erasedType.getTypeParameters(); + String[] names; + if (vars == null || vars.length == 0) { + names = NO_STRINGS; + } else { + int len = vars.length; + names = new String[len]; + for (int i = 0; i < len; ++i) { + names[i] = vars[i].getName(); + } + } + // Check here to give better error message + if (names.length != types.length) { + throw new IllegalArgumentException("Can not create TypeBinding for class "+erasedType.getName() + +" with "+types.length+" type parameter" + +((types.length == 1) ? "" : "s")+": class expects "+names.length); + } + return new TypeBindings(names, types, null); + } + + /** + * Method for creating an instance that has same bindings as this object, + * plus an indicator for additional type variable that may be unbound within + * this context; this is needed to resolve recursive self-references. + * + * @since 1.3 (renamed from "withAdditionalBinding" in 1.2) + */ + public TypeBindings withUnboundVariable(String name) + { + int len = (_unboundVariables == null) ? 0 : _unboundVariables.length; + String[] names = (len == 0) + ? new String[1] : Arrays.copyOf(_unboundVariables, len+1); + names[len] = name; + return new TypeBindings(_names, _types, names); + } + + /* + /********************************************************************** + /* Accessors + /********************************************************************** + */ + + /** + * Find type bound to specified name, if there is one; returns bound type if so, null if not. + */ + public ResolvedType findBoundType(String name) + { + for (int i = 0, len = _names.length; i < len; ++i) { + if (name.equals(_names[i])) { + return _types[i]; + } + } + return null; + } + + public boolean isEmpty() { + return (_types.length == 0); + } + + /** + * Returns number of bindings contained + */ + public int size() { + return _types.length; + } + + public String getBoundName(int index) + { + if (index < 0 || index >= _names.length) { + return null; + } + return _names[index]; + } + + public ResolvedType getBoundType(int index) + { + if (index < 0 || index >= _types.length) { + return null; + } + return _types[index]; + } + + /** + * Accessor for getting bound types in declaration order + */ + public List getTypeParameters() + { + if (_types.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_types); + } + + /** + * @since 2.3 + */ + public boolean hasUnbound(String name) { + if (_unboundVariables != null) { + for (int i = _unboundVariables.length; --i >= 0; ) { + if (name.equals(_unboundVariables[i])) { + return true; + } + } + } + return false; + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public String toString() + { + if (_types.length == 0) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append('<'); + for (int i = 0, len = _types.length; i < len; ++i) { + if (i > 0) { + sb.append(','); + } + sb = _types[i].appendBriefDescription(sb); + } + sb.append('>'); + return sb.toString(); + } + + @Override public int hashCode() { return _hashCode; } + + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + TypeBindings other = (TypeBindings) o; + int len = _types.length; + if (len != other.size()) { + return false; + } + ResolvedType[] otherTypes = other._types; + for (int i = 0; i < len; ++i) { + if (!otherTypes[i].equals(_types[i])) { + return false; + } + } + return true; + } + + /* + /********************************************************************** + /* Package accessible methods + /********************************************************************** + */ + + protected ResolvedType[] typeParameterArray() { + return _types; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/TypeResolver.java b/fine-classmate/src/com/fasterxml/classmate/TypeResolver.java new file mode 100644 index 000000000..ef9da8b89 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/TypeResolver.java @@ -0,0 +1,547 @@ +package com.fasterxml.classmate; + +import java.io.Serializable; +import java.lang.reflect.*; +import java.util.*; + +import com.fasterxml.classmate.types.*; +import com.fasterxml.classmate.util.ClassKey; +import com.fasterxml.classmate.util.ClassStack; +import com.fasterxml.classmate.util.ResolvedTypeCache; + +/** + * Object that is used for resolving generic type information of a class + * so that it is accessible using simple API. Resolved types are also starting + * point for accessing resolved (generics aware) return and argument types + * of class members (methods, fields, constructors). + *

+ * Note that resolver instances are stateful in that resolvers cache resolved + * types for efficiency. Since this is internal state and not directly visible + * to callers, access to state is fully synchronized so that access from + * multiple threads is safe. + */ +@SuppressWarnings("serial") +public class TypeResolver implements Serializable +{ + private final static ResolvedType[] NO_TYPES = new ResolvedType[0]; + + /* + /********************************************************************** + /* Pre-created instances + /********************************************************************** + */ + + /** + * We will also need to return "unknown" type for cases where type variable binding + * is not found ('raw' instances of generic types); easiest way is to + * pre-create type for java.lang.Object + */ + private final static ResolvedObjectType sJavaLangObject = + ResolvedObjectType.create(Object.class, null, null, null); + + /** + * Since number of primitive types is small, and they are frequently needed, + * let's actually pre-create them for efficient reuse. Same goes for limited number + * of other "standard" types... + */ + protected final static HashMap _primitiveTypes; + static { + _primitiveTypes = new HashMap(16); + for (ResolvedPrimitiveType type : ResolvedPrimitiveType.all()) { + _primitiveTypes.put(new ClassKey(type.getErasedType()), type); + } + // should we include "void"? might as well... + _primitiveTypes.put(new ClassKey(Void.TYPE), ResolvedPrimitiveType.voidType()); + // and at least java.lang.Object should be added too. + _primitiveTypes.put(new ClassKey(Object.class), sJavaLangObject); + // but most other types can be added dynamically + } + + /* + /********************************************************************** + /* Caching + /********************************************************************** + */ + + /** + * Simple cache of types resolved by this resolved; capped to last 200 resolved types. + * Caching works because type instances themselves are mostly immutable; + * and properly synchronized in cases where transient data (raw members) are + * accessed. + */ + protected final ResolvedTypeCache _resolvedTypes = new ResolvedTypeCache(200); + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public TypeResolver() { } + + /* + /********************************************************************** + /* Factory methods, with explicit parameterization + /********************************************************************** + */ + + /** + * Factory method for resolving given base type + * using specified types as type parameters. + * Sample usage would be: + *

+     *  ResolvedType type = TypeResolver.resolve(List.class, Integer.class);
+     *
+ * which would be equivalent to + *
+     *  ResolvedType type = TypeResolver.resolve(new GenericType<List<Integer>>() { });
+     *
+ * Note that you can mix different types of type parameters, whether already + * resolved ({@link ResolvedType}), type-erased ({@link java.lang.Class}) or + * generic type reference ({@link GenericType}). + */ + public ResolvedType resolve(Type type, Type... typeParameters) + { + boolean noParams = (typeParameters == null || typeParameters.length == 0); + TypeBindings bindings; + Class rawBase; + + if (type instanceof Class) { + bindings = TypeBindings.emptyBindings(); + if (noParams) { + return _fromClass(null, (Class) type, bindings); + } + rawBase = (Class) type; + } else if (type instanceof GenericType) { + bindings = TypeBindings.emptyBindings(); + if (noParams) { + return _fromGenericType(null, (GenericType) type, bindings); + } + ResolvedType rt = _fromAny(null, type, bindings); + rawBase = rt.getErasedType(); + } else if (type instanceof ResolvedType) { + ResolvedType rt = (ResolvedType) type; + if (noParams) { + return rt; + } + bindings = rt.getTypeBindings(); + rawBase = rt.getErasedType(); + } else { + bindings = TypeBindings.emptyBindings(); + if (noParams) { + return resolve(bindings, type); + } + // Quite convoluted... but necessary to find Class underlying it all + ResolvedType rt = _fromAny(null, type, bindings); + rawBase = rt.getErasedType(); + } + + // Next: resolve type parameters + int len = typeParameters.length; + ResolvedType[] resolvedParams = new ResolvedType[len]; + for (int i = 0; i < len; ++i) { + resolvedParams[i] = _fromAny(null, typeParameters[i], bindings); + } + return _fromClass(null, rawBase, TypeBindings.create(rawBase, resolvedParams)); + } + + /** + * Factory method for constructing array type of given element type. + */ + public ResolvedArrayType arrayType(Type elementType) + { + ResolvedType resolvedElementType = resolve(TypeBindings.emptyBindings(), elementType); + // Arrays are cumbersome for some reason: + Object emptyArray = Array.newInstance(resolvedElementType.getErasedType(), 0); + // Should we try to use cache? It's bit tricky, so let's not bother yet + return new ResolvedArrayType(emptyArray.getClass(), TypeBindings.emptyBindings(), + resolvedElementType); + } + + /** + * Factory method for resolving specified Java {@link java.lang.reflect.Type}, given + * {@link TypeBindings} needed to resolve any type variables. + *

+ * Use of this method is discouraged (use if and only if you really know what you + * are doing!); but if used, type bindings passed should come from {@link ResolvedType} + * instance of declaring class (or interface). + *

+ * NOTE: order of arguments was reversed for 0.8, to avoid problems with + * overload varargs method. + */ + public ResolvedType resolve(TypeBindings typeBindings, Type jdkType) + { + return _fromAny(null, jdkType, typeBindings); + } + + /** + * Factory method for constructing sub-classing specified type; class specified + * as sub-class must be compatible according to basic Java inheritance rules + * (subtype must properly extend or implement specified supertype). + *

+ * A typical use case here is to refine a generic type; for example, given + * that we have generic type like List<Integer>, but we want + * a more specific implementation type like + * class ArrayList but with same parameterization (here just Integer), + * we could achieve it by: + *

+     *  ResolvedType mapType = typeResolver.resolve(List.class, Integer.class);
+     *  ResolveType concreteMapType = typeResolver.resolveSubType(mapType, ArrayList.class);
+     *
+ * (in this case, it would have been simpler to resolve directly; but in some + * cases we are handled supertype and want to refine it, in which case steps + * would be the same but separated by other code) + *

+ * Note that this method will fail if extension can not succeed; either because + * this type is not extendable (sub-classable) -- which is true for primitive + * and array types -- or because given class is not a subtype of this type. + * To check whether subtyping could succeed, you can call + * {@link ResolvedType#canCreateSubtypes()} to see if supertype can ever + * be extended. + * + * @param supertype Type to subtype (extend) + * @param subtype Type-erased sub-class or sub-interface + * + * @return Resolved subtype + * + * @throws IllegalArgumentException If this type can be extended in general, but not into specified sub-class + * @throws UnsupportedOperationException If this type can not be sub-classed + */ + public ResolvedType resolveSubtype(ResolvedType supertype, Class subtype) + throws IllegalArgumentException, UnsupportedOperationException + { + // first: if it's a recursive reference, find out referred-to type + ResolvedType refType = supertype.getSelfReferencedType(); + if (refType != null) { + supertype = refType; + } + // Then, trivial check for case where subtype is supertype... + if (supertype.getErasedType() == subtype) { + return supertype; + } + + if (!supertype.canCreateSubtypes()) { + throw new UnsupportedOperationException("Can not subtype primitive or array types (type "+supertype.getFullDescription()+")"); + } + // In general, must be able to subtype as per JVM rules: + Class superclass = supertype.getErasedType(); + if (!superclass.isAssignableFrom(subtype)) { + throw new IllegalArgumentException("Can not sub-class "+supertype.getBriefDescription() + +" into "+subtype.getName()); + } + // Ok, then, let us instantiate type with placeholders + ResolvedType resolvedSubtype; + int paramCount = subtype.getTypeParameters().length; + TypePlaceHolder[] placeholders; + + if (paramCount == 0) { // no generics + placeholders = null; + resolvedSubtype = resolve(subtype); + } else { + placeholders = new TypePlaceHolder[paramCount]; + for (int i = 0; i < paramCount; ++i) { + placeholders[i] = new TypePlaceHolder(i); + } + resolvedSubtype = resolve(subtype, placeholders); + } + ResolvedType rawSupertype = resolvedSubtype.findSupertype(superclass); + if (rawSupertype == null) { // sanity check, should never occur + throw new IllegalArgumentException("Internal error: unable to locate supertype ("+subtype.getName()+") for type "+supertype.getBriefDescription()); + } + // Ok, then, let's find and verify type assignments + _resolveTypePlaceholders(supertype, rawSupertype); + + // And then re-construct, if necessary + if (paramCount == 0) { // if no type parameters, fine as is + return resolvedSubtype; + } + // but with type parameters, need to reconstruct + ResolvedType[] typeParams = new ResolvedType[paramCount]; + for (int i = 0; i < paramCount; ++i) { + ResolvedType t = placeholders[i].actualType(); + /* Is it ok for it to be left unassigned? For now let's not + * allow that + */ + if (t == null) { + throw new IllegalArgumentException("Failed to find type parameter #"+(i+1)+"/" + +paramCount+" for "+subtype.getName()); + } + typeParams[i] = t; + } + return resolve(subtype, typeParams); + } + + /* + /********************************************************************** + /* Misc other methods + /********************************************************************** + */ + + /** + * Helper method that can be used to checked whether given resolved type + * (with erased type of java.lang.Object) is a placeholder + * for "self-reference"; these are nasty recursive ("self") types + * needed with some interfaces + */ + public static boolean isSelfReference(ResolvedType type) + { + return (type instanceof ResolvedRecursiveType); + } + + /* + /********************************************************************** + /* Internal methods, second-level factory methods + /********************************************************************** + */ + + private ResolvedType _fromAny(ClassStack context, Type mainType, TypeBindings typeBindings) + { + if (mainType instanceof Class) { + return _fromClass(context, (Class) mainType, typeBindings); + } + if (mainType instanceof ResolvedType) { + return (ResolvedType) mainType; + } + if (mainType instanceof ParameterizedType) { + return _fromParamType(context, (ParameterizedType) mainType, typeBindings); + } + if (mainType instanceof GenericType) { + return _fromGenericType(context, (GenericType) mainType, typeBindings); + } + if (mainType instanceof GenericArrayType) { + return _fromArrayType(context, (GenericArrayType) mainType, typeBindings); + } + if (mainType instanceof TypeVariable) { + return _fromVariable(context, (TypeVariable) mainType, typeBindings); + } + if (mainType instanceof WildcardType) { + return _fromWildcard(context, (WildcardType) mainType, typeBindings); + } + // should never get here... + throw new IllegalArgumentException("Unrecognized type class: "+mainType.getClass().getName()); + } + + private ResolvedType _fromClass(ClassStack context, Class rawType, TypeBindings typeBindings) + { + // First: a primitive type perhaps? + ResolvedType type = _primitiveTypes.get(new ClassKey(rawType)); + if (type != null) { + return type; + } + // Second: recursive reference? + if (context == null) { + context = new ClassStack(rawType); + } else { + ClassStack prev = context.find(rawType); + if (prev != null) { + // Self-reference: needs special handling, then... + ResolvedRecursiveType selfRef = new ResolvedRecursiveType(rawType, typeBindings); + prev.addSelfReference(selfRef); + return selfRef; + } + // no, can just add + context = context.child(rawType); + } + + // If not, already recently resolved? + ResolvedType[] typeParameters = typeBindings.typeParameterArray(); + ResolvedTypeCache.Key key = _resolvedTypes.key(rawType, typeParameters); + + type = _resolvedTypes.find(key); + if (type == null) { + type = _constructType(context, rawType, typeBindings); + _resolvedTypes.put(key, type); + } + context.resolveSelfReferences(type); + return type; + } + + /** + * Factory method for resolving given generic type, defined by using sub-class + * instance of {@link GenericType} + */ + private ResolvedType _fromGenericType(ClassStack context, GenericType generic, TypeBindings typeBindings) + { + /* To allow multiple levels of inheritance (just in case someone + * wants to go to town with inheritance of GenericType), + * we better resolve the whole thing; then dig out + * type parameterization... + */ + ResolvedType type = _fromClass(context, generic.getClass(), typeBindings); + ResolvedType genType = type.findSupertype(GenericType.class); + if (genType == null) { // sanity check; shouldn't occur + throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); + } + TypeBindings b = genType.getTypeBindings(); + ResolvedType[] params = b.typeParameterArray(); + if (params.length == 0) { + throw new IllegalArgumentException("Unparameterized GenericType instance ("+generic.getClass().getName()+")"); + } + return params[0]; + } + + private ResolvedType _constructType(ClassStack context, Class rawType, TypeBindings typeBindings) + { + // Ok: no easy shortcut, let's figure out type of type... + if (rawType.isArray()) { + ResolvedType elementType = _fromAny(context, rawType.getComponentType(), typeBindings); + return new ResolvedArrayType(rawType, typeBindings, elementType); + } + // For other types super interfaces are needed... + if (rawType.isInterface()) { + return new ResolvedInterfaceType(rawType, typeBindings, + _resolveSuperInterfaces(context, rawType, typeBindings)); + + } + return new ResolvedObjectType(rawType, typeBindings, + _resolveSuperClass(context, rawType, typeBindings), + _resolveSuperInterfaces(context, rawType, typeBindings)); + } + + private ResolvedType[] _resolveSuperInterfaces(ClassStack context, Class rawType, TypeBindings typeBindings) + { + Type[] types = rawType.getGenericInterfaces(); + if (types == null || types.length == 0) { + return NO_TYPES; + } + int len = types.length; + ResolvedType[] resolved = new ResolvedType[len]; + for (int i = 0; i < len; ++i) { + resolved[i] = _fromAny(context, types[i], typeBindings); + } + return resolved; + } + + /** + * NOTE: return type changed in 1.0.1 from {@link ResolvedObjectType} to + * {@link ResolvedType}, since it was found that other types may + * be returned... + * + * @return Usually a {@link ResolvedObjectType}, but possibly also + * {@link ResolvedRecursiveType} + */ + private ResolvedType _resolveSuperClass(ClassStack context, Class rawType, TypeBindings typeBindings) + { + Type parent = rawType.getGenericSuperclass(); + if (parent == null) { + return null; + } + return _fromAny(context, parent, typeBindings); + } + + private ResolvedType _fromParamType(ClassStack context, ParameterizedType ptype, TypeBindings parentBindings) + { + /* First: what is the actual base type? One odd thing is that 'getRawType' + * returns Type, not Class as one might expect. But let's assume it is + * always of type Class: if not, need to add more code to resolve it... + */ + Class rawType = (Class) ptype.getRawType(); + Type[] params = ptype.getActualTypeArguments(); + int len = params.length; + ResolvedType[] types = new ResolvedType[len]; + + for (int i = 0; i < len; ++i) { + types[i] = _fromAny(context, params[i], parentBindings); + } + // Ok: this gives us current bindings for this type: + TypeBindings newBindings = TypeBindings.create(rawType, types); + return _fromClass(context, rawType, newBindings); + } + + private ResolvedType _fromArrayType(ClassStack context, GenericArrayType arrayType, TypeBindings typeBindings) + { + ResolvedType elementType = _fromAny(context, arrayType.getGenericComponentType(), typeBindings); + // Figuring out raw class for generic array is actually bit tricky... + Object emptyArray = Array.newInstance(elementType.getErasedType(), 0); + return new ResolvedArrayType(emptyArray.getClass(), typeBindings, elementType); + } + + private ResolvedType _fromWildcard(ClassStack context, WildcardType wildType, TypeBindings typeBindings) + { + /* Similar to challenges with TypeVariable, we may have multiple upper bounds. + * But it is also possible that if upper bound defaults to Object, we might want to + * consider lower bounds instead? + * For now, we won't try anything more advanced; above is just for future reference. + */ + return _fromAny(context, wildType.getUpperBounds()[0], typeBindings); + } + + private ResolvedType _fromVariable(ClassStack context, TypeVariable variable, TypeBindings typeBindings) + { + // ideally should find it via bindings: + String name = variable.getName(); + ResolvedType type = typeBindings.findBoundType(name); + + if (type != null) { + return type; + } + + /* but if not, use bounds... note that approach here is simplistic; not taking + * into account possible multiple bounds, nor consider upper bounds. + */ + /* 02-Mar-2011, tatu: As per issue#4, need to avoid self-reference cycles here; + * can be handled by (temporarily) adding binding: + */ + if (typeBindings.hasUnbound(name)) { + return sJavaLangObject; + } + typeBindings = typeBindings.withUnboundVariable(name); + + Type[] bounds = variable.getBounds(); + return _fromAny(context, bounds[0], typeBindings); + } + + /* + /********************************************************************** + /* Internal methods, replacing and verifying type placeholders + /********************************************************************** + */ + + /** + * Method called to verify that types match; and if there are + */ + private void _resolveTypePlaceholders(ResolvedType expectedType, ResolvedType actualType) + throws IllegalArgumentException + { + List expectedTypes = expectedType.getTypeParameters(); + List actualTypes = actualType.getTypeParameters(); + for (int i = 0, len = expectedTypes.size(); i < len; ++i) { + ResolvedType exp = expectedTypes.get(i); + ResolvedType act = actualTypes.get(i); + if (!_typesMatch(exp, act)) { + throw new IllegalArgumentException("Type parameter #"+(i+1)+"/"+len+" differs; expected " + +exp.getBriefDescription()+", got "+act.getBriefDescription()); + } + } + } + + private boolean _typesMatch(ResolvedType exp, ResolvedType act) + { + // Simple equality check, except for one thing: place holders for 'act' + if (act instanceof TypePlaceHolder) { + ((TypePlaceHolder) act).actualType(exp); + return true; + } + // but due to recursive nature can't call equality... + if (exp.getErasedType() != act.getErasedType()) { + return false; + } + // But we can check type parameters "blindly" + List expectedTypes = exp.getTypeParameters(); + List actualTypes = act.getTypeParameters(); + for (int i = 0, len = expectedTypes.size(); i < len; ++i) { + ResolvedType exp2 = expectedTypes.get(i); + ResolvedType act2 = actualTypes.get(i); + if (!_typesMatch(exp2, act2)) { + return false; + } + } + return true; + } + + /* + /********************************************************************** + /* Helper classes + /********************************************************************** + */ +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/HierarchicType.java b/fine-classmate/src/com/fasterxml/classmate/members/HierarchicType.java new file mode 100644 index 000000000..e4e5b2eba --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/HierarchicType.java @@ -0,0 +1,68 @@ +package com.fasterxml.classmate.members; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.ResolvedTypeWithMembers; + +/** + * Container class used to enclose information about a single {@link ResolvedType} + * that is part of {@link ResolvedTypeWithMembers}. + */ +public final class HierarchicType +{ + /** + * Whether this type instance represents a mix-in; if so, it can only result in + * addition of annotations but not in addition of actual members. + */ + protected final boolean _isMixin; + + protected final ResolvedType _type; + + /** + * Relative priority of this type in hierarchy; higher priority members can override + * lower priority members. Priority values are unique and are based on type index + * (starting from 0), although they are not to be used for indexing. + */ + protected final int _priority; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public HierarchicType(ResolvedType type, boolean mixin, int priority) + { + _type = type; + _isMixin = mixin; + _priority = priority; + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + public ResolvedType getType() { return _type; } + public Class getErasedType() { return _type.getErasedType(); } + public boolean isMixin() { return _isMixin; } + public int getPriority() { return _priority; } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public String toString() { return _type.toString(); } + @Override public int hashCode() { return _type.hashCode(); } + + @Override + public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + HierarchicType other = (HierarchicType) o; + return _type.equals(other._type); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/RawConstructor.java b/fine-classmate/src/com/fasterxml/classmate/members/RawConstructor.java new file mode 100644 index 000000000..f90a53e3c --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/RawConstructor.java @@ -0,0 +1,61 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Constructor; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.util.MethodKey; + +public final class RawConstructor extends RawMember +{ + protected final Constructor _constructor; + + protected final int _hashCode; + + public RawConstructor(ResolvedType context, Constructor constructor) + { + super(context); + _constructor = constructor; + _hashCode = (_constructor == null ? 0 : _constructor.hashCode()); + } + + /** + * Although constructors are different from other methods, we can use + * {@link MethodKey} easily. + */ + public MethodKey createKey() + { + String name = ""; // do not use _constructor.getName() to allow for 'mix-ins' + Class[] argTypes = _constructor.getParameterTypes(); // return of Constructor#getParameterTypes will never be null + return new MethodKey(name, argTypes); + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + @Override + public Constructor getRawMember() { + return _constructor; + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public int hashCode() + { + return _hashCode; + } + + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + RawConstructor other = (RawConstructor) o; + return (other._constructor == _constructor); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/RawField.java b/fine-classmate/src/com/fasterxml/classmate/members/RawField.java new file mode 100644 index 000000000..29caf0193 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/RawField.java @@ -0,0 +1,58 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.ResolvedType; + +public final class RawField extends RawMember +{ + protected final Field _field; + + private final int _hashCode; + + public RawField(ResolvedType context, Field field) + { + super(context); + _field = field; + _hashCode = (_field == null ? 0 : _field.hashCode()); + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + @Override + public Field getRawMember() { + return _field; + } + + public boolean isTransient() { + return Modifier.isTransient(getModifiers()); + } + + public boolean isVolatile() { + return Modifier.isVolatile(getModifiers()); + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + RawField other = (RawField) o; + return (other._field == _field); + } + + @Override public int hashCode() + { + return _hashCode; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/RawMember.java b/fine-classmate/src/com/fasterxml/classmate/members/RawMember.java new file mode 100644 index 000000000..2d71fec26 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/RawMember.java @@ -0,0 +1,98 @@ +package com.fasterxml.classmate.members; + +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Member; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.ResolvedType; + +/** + * Base class for all "raw" member (field, method, constructor) types; raw means that + * actual types are not yet resolved, but relationship to declaring type is + * retained for eventual resolution. + * Instances are typically created by {@link com.fasterxml.classmate.ResolvedType} + * when requested, and form the input to eventual full flattening of type members. + */ +public abstract class RawMember +{ + /** + * {@link ResolvedType} (class with generic type parameters) that declared + * this member + */ + protected final ResolvedType _declaringType; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + protected RawMember(ResolvedType context) + { + _declaringType = context; + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + public final ResolvedType getDeclaringType() { + return _declaringType; + } + + public abstract Member getRawMember(); + + public String getName() { + return getRawMember().getName(); + } + + public boolean isStatic() { + return Modifier.isStatic(getModifiers()); + } + + public boolean isFinal() { + return Modifier.isFinal(getModifiers()); + } + + public boolean isPrivate() { + return Modifier.isPrivate(getModifiers()); + } + + public boolean isProtected() { + return Modifier.isProtected(getModifiers()); + } + + public boolean isPublic() { + return Modifier.isPublic(getModifiers()); + } + + public Annotation[] getAnnotations() { + return ((AnnotatedElement) getRawMember()).getAnnotations(); + } + + /* + /********************************************************************** + /* Standard method overrides + /********************************************************************** + */ + + // make abstract to force implementation by sub-class + @Override public abstract boolean equals(Object o); + + @Override public abstract int hashCode(); + + @Override public String toString() { + return getName(); + } + + /* + /********************************************************************** + /* Package methods + /********************************************************************** + */ + + protected final int getModifiers() { return getRawMember().getModifiers(); } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/RawMethod.java b/fine-classmate/src/com/fasterxml/classmate/members/RawMethod.java new file mode 100644 index 000000000..b7fff744e --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/RawMethod.java @@ -0,0 +1,74 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.util.MethodKey; + +public final class RawMethod extends RawMember +{ + protected final Method _method; + + protected final int _hashCode; + + public RawMethod(ResolvedType context, Method method) + { + super(context); + _method = method; + _hashCode = (_method == null ? 0 : _method.hashCode()); + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + @Override + public Method getRawMember() { + return _method; + } + + public boolean isAbstract() { + return Modifier.isAbstract(getModifiers()); + } + + public boolean isStrict() { + return Modifier.isStrict(getModifiers()); + } + + public boolean isNative() { + return Modifier.isNative(getModifiers()); + } + + public boolean isSynchronized() { + return Modifier.isSynchronized(getModifiers()); + } + + public MethodKey createKey() + { + String name = _method.getName(); + Class[] argTypes = _method.getParameterTypes(); // return of Method#getParameterTypes will never be null + return new MethodKey(name, argTypes); + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public int hashCode() + { + return _hashCode; + } + + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + RawMethod other = (RawMethod) o; + return (other._method == _method); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/ResolvedConstructor.java b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedConstructor.java new file mode 100644 index 000000000..d6e1fa2e0 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedConstructor.java @@ -0,0 +1,26 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Constructor; + +import com.fasterxml.classmate.Annotations; +import com.fasterxml.classmate.ResolvedType; + +/** + * Class that represents a constructor that has fully resolved generic + * type information and annotation information. + */ +public final class ResolvedConstructor extends ResolvedParameterizedMember> +{ + public ResolvedConstructor(ResolvedType context, Annotations ann, Constructor constructor, + ResolvedType[] argumentTypes) + { + super(context, ann, constructor, null, argumentTypes); + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/ResolvedField.java b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedField.java new file mode 100644 index 000000000..7fb409830 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedField.java @@ -0,0 +1,36 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.Annotations; +import com.fasterxml.classmate.ResolvedType; + +public final class ResolvedField extends ResolvedMember + implements Comparable +{ + public ResolvedField(ResolvedType context, Annotations ann, + Field field, ResolvedType type) + { + super(context, ann, field, type); + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + public boolean isTransient() { + return Modifier.isTransient(getModifiers()); + } + + public boolean isVolatile() { + return Modifier.isVolatile(getModifiers()); + } + + @Override + public int compareTo(ResolvedField other) { + return getName().compareTo(other.getName()); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMember.java b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMember.java new file mode 100644 index 000000000..848c2c858 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMember.java @@ -0,0 +1,156 @@ +package com.fasterxml.classmate.members; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Member; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.Annotations; +import com.fasterxml.classmate.ResolvedType; + +/** + * Fully type-resolved equivalent of {@link RawMember}. Only members "that matter" (ones not + * overridden, or filtered out) are resolved, since resolution process can add non-trivial + * overhead. + */ +public abstract class ResolvedMember +{ + /** + * {@link ResolvedType} (class with generic type parameters) that declared + * this member + */ + protected final ResolvedType _declaringType; + + protected final Annotations _annotations; + + protected final T _member; + + protected final ResolvedType _type; + + protected final int _hashCode; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + protected ResolvedMember(ResolvedType context, Annotations ann, T member, ResolvedType type) + { + _declaringType = context; + _annotations = ann; + _member = member; + _type = type; + _hashCode = (_member == null ? 0 : _member.hashCode()); + } + + public void applyOverride(Annotation override) + { + _annotations.add(override); + } + + public void applyOverrides(Annotations overrides) + { + _annotations.addAll(overrides); + } + + public void applyDefault(Annotation override) + { + _annotations.addAsDefault(override); + } + + public A get(Class cls) + { + return _annotations.get(cls); + } + + public Annotations getAnnotations() + { + return _annotations; + } + + /* + /********************************************************************** + /* Simple accessors + /********************************************************************** + */ + + public final ResolvedType getDeclaringType() { + return _declaringType; + } + + /** + * Returns type of this member; if it has one, for methods this is the + * return type, for fields field type, and for constructors null. + */ + public ResolvedType getType() { + return _type; + } + + /** + * Returns JDK object that represents member. + */ + public T getRawMember() { + return _member; + } + + public String getName() { + return getRawMember().getName(); + } + + public boolean isStatic() { + return Modifier.isStatic(getModifiers()); + } + + public boolean isFinal() { + return Modifier.isFinal(getModifiers()); + } + + public boolean isPrivate() { + return Modifier.isPrivate(getModifiers()); + } + + public boolean isProtected() { + return Modifier.isProtected(getModifiers()); + } + + public boolean isPublic() { + return Modifier.isPublic(getModifiers()); + } + + /* + /********************************************************************** + /* Standard method overrides + /********************************************************************** + */ + + @Override public String toString() { + return getName(); + } + + /* + /********************************************************************** + /* Package methods + /********************************************************************** + */ + + protected final int getModifiers() { return getRawMember().getModifiers(); } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override public int hashCode() { + return _hashCode; + } + + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + ResolvedMember other = (ResolvedMember) o; + return (other._member == _member); + } + +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMethod.java b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMethod.java new file mode 100644 index 000000000..6b6d16da7 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedMethod.java @@ -0,0 +1,65 @@ +package com.fasterxml.classmate.members; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import com.fasterxml.classmate.Annotations; +import com.fasterxml.classmate.ResolvedType; + +public final class ResolvedMethod extends ResolvedParameterizedMember + implements Comparable +{ + public ResolvedMethod(ResolvedType context, Annotations ann, Method method, + ResolvedType returnType, ResolvedType[] argumentTypes) + { + super(context, ann, method, returnType, argumentTypes); + } + + /* + /********************************************************************** + /* Simple accessors from base class + /********************************************************************** + */ + + public boolean isAbstract() { + return Modifier.isAbstract(getModifiers()); + } + + public boolean isStrict() { + return Modifier.isStrict(getModifiers()); + } + + public boolean isNative() { + return Modifier.isNative(getModifiers()); + } + + public boolean isSynchronized() { + return Modifier.isSynchronized(getModifiers()); + } + + /* + /********************************************************************** + /* Extended API + /********************************************************************** + */ + + public ResolvedType getReturnType() { return getType(); } + + /* + /********************************************************************** + /* Standard method override + /********************************************************************** + */ + + @Override + public int compareTo(ResolvedMethod other) + { + // primary sort by name (alphabetic); secondary by arg count (ascending) + int diff = getName().compareTo(other.getName()); + if (diff == 0) { + // subtract fine, no fear of overflow here + diff = getArgumentCount() - other.getArgumentCount(); + } + return diff; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/ResolvedParameterizedMember.java b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedParameterizedMember.java new file mode 100644 index 000000000..b0f117e24 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/ResolvedParameterizedMember.java @@ -0,0 +1,81 @@ +package com.fasterxml.classmate.members; + +import com.fasterxml.classmate.Annotations; +import com.fasterxml.classmate.ResolvedType; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Member; + +/** + * Base type for resolved members that take some parameters (e.g. methods and constructors). + */ +public abstract class ResolvedParameterizedMember extends ResolvedMember { + + protected final ResolvedType[] _paramTypes; + + protected final Annotations[] _paramAnnotations; + + protected ResolvedParameterizedMember(ResolvedType context, Annotations ann, + T member, ResolvedType type, ResolvedType[] argumentTypes) { + super(context, ann, member, type); + _paramTypes = argumentTypes == null ? ResolvedType.NO_TYPES : argumentTypes; + _paramAnnotations = new Annotations[_paramTypes.length]; + } + + public Annotations getParameterAnnotations(int index) { + if (index >= _paramTypes.length) + throw new IndexOutOfBoundsException("No parameter at index " + index + ", this is greater than the total number of parameters"); + + if (_paramAnnotations[index] == null) { + _paramAnnotations[index] = new Annotations(); + } + return _paramAnnotations[index]; + } + + public void applyParamOverride(int index, Annotation override) + { + if (index >= _paramAnnotations.length) + return; + + getParameterAnnotations(index).add(override); + } + + public void applyParamOverrides(int index, Annotations overrides) + { + if (index >= _paramAnnotations.length) + return; + + getParameterAnnotations(index).addAll(overrides); + } + + public void applyParamDefault(int index, Annotation defaultValue) + { + if (index >= _paramAnnotations.length) + return; + + getParameterAnnotations(index).addAsDefault(defaultValue); + } + + public A getParam(int index, Class cls) + { + if (index >= _paramAnnotations.length) + return null; + + return _paramAnnotations[index].get(cls); + } + + /** + * Returns number of arguments method takes. + */ + public int getArgumentCount() { + return _paramTypes.length; + } + + public ResolvedType getArgumentType(int index) + { + if (index < 0 || index >= _paramTypes.length) { + return null; + } + return _paramTypes[index]; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/members/package-info.java b/fine-classmate/src/com/fasterxml/classmate/members/package-info.java new file mode 100644 index 000000000..a4407f39a --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/members/package-info.java @@ -0,0 +1,5 @@ +/** + * Package that contains implementations of various member types + * (methods, fields, constructors) + */ +package com.fasterxml.classmate.members; diff --git a/fine-classmate/src/com/fasterxml/classmate/package-info.java b/fine-classmate/src/com/fasterxml/classmate/package-info.java new file mode 100644 index 000000000..8afcbaddc --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/package-info.java @@ -0,0 +1,13 @@ +/** + * Package that contains main public interface of ClassMate + * package. + *

+ * Most commonly resolution starts with {@link com.fasterxml.classmate.TypeResolver}, + * using its resolve() method, which returns a + * {@link com.fasterxml.classmate.ResolvedType} instance. + * These type objects contain all necessary information about type itself; + * but if type information on members (fields, methods, constructors, static + * members) is needed, {@link com.fasterxml.classmate.MemberResolver} can + * resolve types for members: it takes {@link com.fasterxml.classmate.ResolvedType}s. + */ +package com.fasterxml.classmate; diff --git a/fine-classmate/src/com/fasterxml/classmate/types/ResolvedArrayType.java b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedArrayType.java new file mode 100644 index 000000000..4630f3a25 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedArrayType.java @@ -0,0 +1,108 @@ +package com.fasterxml.classmate.types; + +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; + +public final class ResolvedArrayType extends ResolvedType +{ + protected final ResolvedType _elementType; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public ResolvedArrayType(Class erased, TypeBindings bindings, + ResolvedType elementType) + { + super(erased, bindings); + _elementType = elementType; + } + + @Override + public boolean canCreateSubtypes() { + return false; + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public ResolvedType getParentClass() { return null; } + + @Override + public ResolvedType getSelfReferencedType() { return null; } + + @Override + public List getImplementedInterfaces() { + return Collections.emptyList(); + } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public boolean isInterface() { + return false; + } + + @Override + public boolean isAbstract() { return false; } + + @Override + public ResolvedType getArrayElementType() { return _elementType; } + + @Override + public boolean isArray() { return true; } + + @Override + public boolean isPrimitive() { return false; } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + // defaults are fine (nothing to access) + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + sb.append('['); + return _elementType.appendSignature(sb); + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + sb.append('['); + return _elementType.appendErasedSignature(sb); + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) + { + sb = _elementType.appendBriefDescription(sb); + sb.append("[]"); + return sb; + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) { + return appendBriefDescription(sb); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/types/ResolvedInterfaceType.java b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedInterfaceType.java new file mode 100644 index 000000000..6a4d9eb33 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedInterfaceType.java @@ -0,0 +1,162 @@ +package com.fasterxml.classmate.types; + +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; +import com.fasterxml.classmate.members.RawField; +import com.fasterxml.classmate.members.RawMethod; + +public class ResolvedInterfaceType extends ResolvedType +{ + + /** + * List of interfaces this type implements; may be empty but never null + */ + protected final ResolvedType[] _superInterfaces; + + /** + * Interfaces can have static final (constant) fields. + */ + protected RawField[] _constantFields; + + /** + * Interface methods are all public and abstract. + */ + protected RawMethod[] _memberMethods; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public ResolvedInterfaceType(Class erased, TypeBindings bindings, + ResolvedType[] superInterfaces) + { + super(erased, bindings); + _superInterfaces = (superInterfaces == null ? NO_TYPES : superInterfaces); + } + + @Override + public boolean canCreateSubtypes() { + return true; + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public ResolvedType getParentClass() { + // interfaces do not have parent class, just interfaces + return null; + } + + @Override + public ResolvedType getSelfReferencedType() { return null; } + + @Override + public List getImplementedInterfaces() { + return (_superInterfaces.length == 0) ? + Collections.emptyList() : Arrays.asList(_superInterfaces); + } + + @Override + public ResolvedType getArrayElementType() { // interfaces are never arrays, so: + return null; + } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public boolean isInterface() { return true; } + + @Override + public boolean isAbstract() { return true; } + + @Override + public boolean isArray() { return false; } + + @Override + public boolean isPrimitive() { return false; } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + @Override + public synchronized List getStaticFields() + { + // Interfaces can have static fields, but only as static constants... + if (_constantFields == null) { + _constantFields = _getFields(true); + } + if (_constantFields.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_constantFields); + } + + @Override + public synchronized List getMemberMethods() + { + if (_memberMethods == null) { + _memberMethods = _getMethods(false); + } + if (_memberMethods.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_memberMethods); + } + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + return _appendClassSignature(sb); + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + return _appendErasedClassSignature(sb); + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) { + return _appendClassDescription(sb); + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) + { + sb = _appendClassDescription(sb); + // interfaces 'extend' other interfaces... + int count = _superInterfaces.length; + if (count > 0) { + sb.append(" extends "); + for (int i = 0; i < count; ++i) { + if (i > 0) { + sb.append(","); + } + sb = _superInterfaces[i].appendBriefDescription(sb); + } + } + return sb; + } +} + + + diff --git a/fine-classmate/src/com/fasterxml/classmate/types/ResolvedObjectType.java b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedObjectType.java new file mode 100644 index 000000000..28f35e893 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedObjectType.java @@ -0,0 +1,287 @@ +package com.fasterxml.classmate.types; + +import java.lang.reflect.Modifier; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; +import com.fasterxml.classmate.members.RawConstructor; +import com.fasterxml.classmate.members.RawField; +import com.fasterxml.classmate.members.RawMethod; + +/** + * Type implementation for classes that do not represent interfaces, + * primitive or array types. + */ +public class ResolvedObjectType extends ResolvedType +{ + /** + * While fundamentally super class has to be {@link ResolvedObjectType} + * (or null for {@link java.lang.Object}), we may need to hold on to + * a {@link ResolvedRecursiveType} occasionally. + */ + protected final ResolvedType _superClass; + + /** + * List of interfaces this type implements; may be empty but never null + */ + protected final ResolvedType[] _superInterfaces; + + /** + * Modifiers of the underlying class. + */ + protected final int _modifiers; + + /** + * Constructors declared by the resolved Object class. + */ + protected RawConstructor[] _constructors; + + protected RawField[] _memberFields; + protected RawField[] _staticFields; + + protected RawMethod[] _memberMethods; + protected RawMethod[] _staticMethods; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public ResolvedObjectType(Class erased, TypeBindings bindings, + ResolvedType superClass, List interfaces) + { + this(erased, bindings, superClass, + (interfaces == null || interfaces.isEmpty()) ? NO_TYPES : + interfaces.toArray(new ResolvedType[interfaces.size()])); + } + + public ResolvedObjectType(Class erased, TypeBindings bindings, + ResolvedType superClass, ResolvedType[] interfaces) + { + super(erased, bindings); + /* 19-Aug-2014, tatu: bit unclean, but has to do for now. + * Problem is, there is no common super-type, nor can we yet + * force or coerce recursive types. Rather, they may only get + * resolved only slightly after construction. So... need to + * keep a reference. + */ + if (superClass != null) { + if (!(superClass instanceof ResolvedObjectType) + && !(superClass instanceof ResolvedRecursiveType) + ) { + throw new IllegalArgumentException("Unexpected parent type for " + +erased.getName()+": "+superClass.getClass().getName()); + } + } + + _superClass = superClass; + _superInterfaces = (interfaces == null) ? NO_TYPES : interfaces; + _modifiers = erased.getModifiers(); + } + + @Deprecated // since 1.1; removed from 1.2 -- kept for binary backwards compatibility + public ResolvedObjectType(Class erased, TypeBindings bindings, + ResolvedObjectType superClass, List interfaces) + { + this(erased, bindings, (ResolvedType) superClass, interfaces); + } + + @Deprecated // since 1.1; removed from 1.2 -- kept for binary backwards compatibility + public ResolvedObjectType(Class erased, TypeBindings bindings, + ResolvedObjectType superClass, ResolvedType[] interfaces) + { + this(erased, bindings, (ResolvedType) superClass, interfaces); + } + + public static ResolvedObjectType create(Class erased, TypeBindings bindings, + ResolvedType superClass, List interfaces) + { + return new ResolvedObjectType(erased, bindings, superClass, interfaces); + } + + @Override + public boolean canCreateSubtypes() { + return true; + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public ResolvedObjectType getParentClass() { + + /* 19-Aug-2014, tatu: Ugly does it... sigh. + * But can't be helped because ResolvedRecursiveType is typically only + * resolved after instances of this type have been constructed. + * This means that resolution will need to be done somewhat dynamically. + */ + if (_superClass == null) { + return null; + } + if (_superClass instanceof ResolvedObjectType) { + return (ResolvedObjectType) _superClass; + } + ResolvedType rt = ((ResolvedRecursiveType) _superClass).getSelfReferencedType(); + if (!(rt instanceof ResolvedObjectType)) { + throw new IllegalStateException("Internal error: self-referential parent type (" + +_superClass+") does not resolve into proper ResolvedObjectType, but instead to: " + +rt); + } + return (ResolvedObjectType) rt; + } + + @Override + public ResolvedType getSelfReferencedType() { return null; } + + @Override + public List getImplementedInterfaces() { + return (_superInterfaces.length == 0) ? + Collections.emptyList() : Arrays.asList(_superInterfaces); + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public final ResolvedType getArrayElementType() { return null; } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public final boolean isInterface() { return false; } + + @Override + public boolean isAbstract() { + return Modifier.isAbstract(_modifiers); + } + + @Override + public final boolean isArray() { return false; } + + @Override + public final boolean isPrimitive() { return false; } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + @Override + public synchronized List getMemberFields() + { + if (_memberFields == null) { + _memberFields = _getFields(false); + } + if (_memberFields.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_memberFields); + } + + @Override + public synchronized List getStaticFields() + { + if (_staticFields == null) { + _staticFields = _getFields(true); + } + if (_staticFields.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_staticFields); + } + + @Override + public synchronized List getMemberMethods() + { + if (_memberMethods == null) { + _memberMethods = _getMethods(false); + } + if (_memberMethods.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_memberMethods); + } + + @Override + public synchronized List getStaticMethods() + { + if (_staticMethods == null) { + _staticMethods = _getMethods(true); + } + if (_staticMethods.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_staticMethods); + } + + @Override + public List getConstructors() + { + if (_constructors == null) { + _constructors = _getConstructors(); + } + if (_constructors.length == 0) { + return Collections.emptyList(); + } + return Arrays.asList(_constructors); + } + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + return _appendClassSignature(sb); + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + return _appendErasedClassSignature(sb); + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) { + return _appendClassDescription(sb); + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) + { + sb = _appendClassDescription(sb); + if (_superClass != null) { + sb.append(" extends "); + sb = _superClass.appendBriefDescription(sb); + } + // interfaces 'extend' other interfaces... + int count = _superInterfaces.length; + if (count > 0) { + sb.append(" implements "); + for (int i = 0; i < count; ++i) { + if (i > 0) { + sb.append(","); + } + sb = _superInterfaces[i].appendBriefDescription(sb); + } + } + return sb; + } +} + diff --git a/fine-classmate/src/com/fasterxml/classmate/types/ResolvedPrimitiveType.java b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedPrimitiveType.java new file mode 100644 index 000000000..1c9be3624 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedPrimitiveType.java @@ -0,0 +1,157 @@ +package com.fasterxml.classmate.types; + +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; + +/** + * Type used for Java primitive types (which does not include arrays here). + *

+ * Since set of primitive types is bounded, constructor is defined as protected, + * and class final; that is, new primitive types are not to be constructed + * by calling applications. + */ +public final class ResolvedPrimitiveType extends ResolvedType +{ + private final static ResolvedPrimitiveType VOID = new ResolvedPrimitiveType(Void.TYPE, 'V', "void"); + + /** + * Primitive types have single-character Signature, easy and efficient + * to just store here + */ + protected final String _signature; + + /** + * Human-readable description should be simple as well + */ + protected final String _description; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + protected ResolvedPrimitiveType(Class erased, char sig, String desc) + { + super(erased, TypeBindings.emptyBindings()); + _signature = String.valueOf(sig); + _description = desc; + } + + public static List all() + { + ArrayList all = new ArrayList(); + all.add(new ResolvedPrimitiveType(Boolean.TYPE, 'Z', "boolean")); + all.add(new ResolvedPrimitiveType(Byte.TYPE, 'B', "byte")); + all.add(new ResolvedPrimitiveType(Short.TYPE, 'S', "short")); + all.add(new ResolvedPrimitiveType(Character.TYPE, 'C', "char")); + all.add(new ResolvedPrimitiveType(Integer.TYPE, 'I', "int")); + all.add(new ResolvedPrimitiveType(Long.TYPE, 'J', "long")); + all.add(new ResolvedPrimitiveType(Float.TYPE, 'F', "float")); + all.add(new ResolvedPrimitiveType(Double.TYPE, 'D', "double")); + return all; + } + + public static ResolvedPrimitiveType voidType() + { + return VOID; + } + + @Override + public boolean canCreateSubtypes() { + return false; + } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public ResolvedType getSelfReferencedType() { return null; } + + @Override + public ResolvedType getParentClass() { return null; } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public boolean isInterface() { return false; } + + @Override + public boolean isAbstract() { return false; } + + @Override + public ResolvedType getArrayElementType() { return null; } + + @Override + public boolean isArray() { return false; } + + @Override + public boolean isPrimitive() { return true; } + + @Override + public List getImplementedInterfaces() { + return Collections.emptyList(); + } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + // Primitive types are simple; no fields, no methods, no constructors + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public String getSignature() { + return _signature; + } + + @Override + public String getErasedSignature() { + return _signature; + } + + @Override + public String getFullDescription() { + return _description; + } + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + sb.append(_signature); + return sb; + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + sb.append(_signature); + return sb; + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) { + sb.append(_description); + return sb; + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) { + sb.append(_description); + return sb; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/types/ResolvedRecursiveType.java b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedRecursiveType.java new file mode 100644 index 000000000..c8d7a1810 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/ResolvedRecursiveType.java @@ -0,0 +1,149 @@ +package com.fasterxml.classmate.types; + +import java.lang.reflect.Modifier; +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; +import com.fasterxml.classmate.members.RawConstructor; +import com.fasterxml.classmate.members.RawField; +import com.fasterxml.classmate.members.RawMethod; + +/** + * Specialized type placeholder used in cases where type definition is + * recursive; to avoid infinite loop, reference that would be "back" in + * hierarchy is represented by an instance of this class. + * Underlying information is achievable (for full resolution), but + * not exposed using super type (parent) accessors; and has special + * handling when used for constructing descriptions. + */ +public class ResolvedRecursiveType extends ResolvedType +{ + /** + * Actual fully resolved type; assigned once resolution is complete + */ + protected ResolvedType _referencedType; + + /* + /********************************************************************** + /* Life cycle + /********************************************************************** + */ + + public ResolvedRecursiveType(Class erased, TypeBindings bindings) + { + super(erased, bindings); + } + + @Override + public boolean canCreateSubtypes() { + return _referencedType.canCreateSubtypes(); + } + + public void setReference(ResolvedType ref) + { + // sanity check; should not be called multiple times + if (_referencedType != null) { + throw new IllegalStateException("Trying to re-set self reference; old value = "+_referencedType+", new = "+ref); + } + _referencedType = ref; + } + + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + /** + * To avoid infinite loops, will return null; + */ + @Override + public ResolvedType getParentClass() { + return null; + } + + @Override + public ResolvedType getSelfReferencedType() { return _referencedType; } + + /** + * To avoid infinite loops, will return empty list + */ + @Override + public List getImplementedInterfaces() { + return Collections.emptyList(); + } + + /** + * To avoid infinite loops, will return null type + */ + @Override + public ResolvedType getArrayElementType() { // interfaces are never arrays, so: + return null; + } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public boolean isInterface() { return _erasedType.isInterface(); } + + @Override + public boolean isAbstract() { return Modifier.isAbstract(_erasedType.getModifiers()); } + + @Override + public boolean isArray() { return _erasedType.isArray(); } + + @Override + public boolean isPrimitive() { return false; } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + @Override + public List getMemberFields() { return _referencedType.getMemberFields(); } + @Override + public List getStaticFields() { return _referencedType.getStaticFields(); } + @Override + public List getStaticMethods() { return _referencedType.getStaticMethods(); } + @Override + public List getMemberMethods() { return _referencedType.getMemberMethods(); } + @Override + public List getConstructors() { return _referencedType.getConstructors(); } + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + // to avoid infinite recursion, only print type erased version + return appendErasedSignature(sb); + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + return _appendErasedClassSignature(sb); + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) { + return _appendClassDescription(sb); + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) + { + // should never get called, but just in case, only print brief description + return appendBriefDescription(sb); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/types/TypePlaceHolder.java b/fine-classmate/src/com/fasterxml/classmate/types/TypePlaceHolder.java new file mode 100644 index 000000000..c7f431a9c --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/TypePlaceHolder.java @@ -0,0 +1,101 @@ +package com.fasterxml.classmate.types; + +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeBindings; + +/** + * Placeholder used for resolving type assignments to figure out + * type parameters for subtypes. + */ +public class TypePlaceHolder extends ResolvedType +{ + protected final int _ordinal; + + /** + * Type assigned during wildcard resolution + */ + protected ResolvedType _actualType; + + public TypePlaceHolder(int ordinal) + { + super(Object.class, TypeBindings.emptyBindings()); + _ordinal = ordinal; + } + + @Override + public boolean canCreateSubtypes() { return false; } + + public ResolvedType actualType() { return _actualType; } + public void actualType(ResolvedType t) { _actualType = t; } + + /* + /********************************************************************** + /* Accessors for related types + /********************************************************************** + */ + + @Override + public ResolvedType getParentClass() { return null; } + + @Override + public ResolvedType getSelfReferencedType() { return null; } + + @Override + public List getImplementedInterfaces() { return Collections.emptyList(); } + + @Override + public ResolvedType getArrayElementType() { return null; } + + /* + /********************************************************************** + /* Simple property accessors + /********************************************************************** + */ + + @Override + public boolean isInterface() { return false; } + + @Override + public boolean isAbstract() { return true; } + + @Override + public boolean isArray() { return false; } + + @Override + public boolean isPrimitive() { return false; } + + /* + /********************************************************************** + /* Accessors for raw (minimally procesed) members + /********************************************************************** + */ + + /* + /********************************************************************** + /* String representations + /********************************************************************** + */ + + @Override + public StringBuilder appendSignature(StringBuilder sb) { + return _appendClassSignature(sb); + } + + @Override + public StringBuilder appendErasedSignature(StringBuilder sb) { + return _appendErasedClassSignature(sb); + } + + @Override + public StringBuilder appendBriefDescription(StringBuilder sb) { + sb.append('<').append(_ordinal).append('>'); + return sb; + } + + @Override + public StringBuilder appendFullDescription(StringBuilder sb) { + return appendBriefDescription(sb); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/types/package-info.java b/fine-classmate/src/com/fasterxml/classmate/types/package-info.java new file mode 100644 index 000000000..ff3f9e2fc --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/types/package-info.java @@ -0,0 +1,5 @@ +/** + * Package that contains {@link com.fasterxml.classmate.ResolvedType} + * implementation classes. + */ +package com.fasterxml.classmate.types; diff --git a/fine-classmate/src/com/fasterxml/classmate/util/ClassKey.java b/fine-classmate/src/com/fasterxml/classmate/util/ClassKey.java new file mode 100644 index 000000000..261b86238 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/util/ClassKey.java @@ -0,0 +1,69 @@ +package com.fasterxml.classmate.util; + +import java.io.Serializable; + +/** + * Helper class used as key when we need efficient Class-to-value lookups. + */ +@SuppressWarnings("serial") +public class ClassKey + implements Comparable, Serializable +{ + private final String _className; + + private final Class _class; + + /** + * Let's cache hash code straight away, since we are almost certain to need it. + */ + private final int _hashCode; + + public ClassKey(Class clz) + { + _class = clz; + _className = clz.getName(); + _hashCode = _className.hashCode(); + } + + /* + /********************************************************************** + /* Comparable + /********************************************************************** + */ + + @Override + public int compareTo(ClassKey other) + { + // Just need to sort by name, ok to collide (unless used in TreeMap/Set!) + return _className.compareTo(other._className); + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + @Override + public boolean equals(Object o) + { + if (o == this) return true; + if (o == null) return false; + if (o.getClass() != getClass()) return false; + ClassKey other = (ClassKey) o; + + /* Is it possible to have different Class object for same name + class loader combo? + * Let's assume answer is no: if this is wrong, will need to uncomment following functionality + */ + /* + return (other._className.equals(_className)) + && (other._class.getClassLoader() == _class.getClassLoader()); + */ + return other._class == _class; + } + + @Override public int hashCode() { return _hashCode; } + + @Override public String toString() { return _className; } + +} diff --git a/fine-classmate/src/com/fasterxml/classmate/util/ClassStack.java b/fine-classmate/src/com/fasterxml/classmate/util/ClassStack.java new file mode 100644 index 000000000..57bf73b59 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/util/ClassStack.java @@ -0,0 +1,72 @@ +package com.fasterxml.classmate.util; + +import java.util.ArrayList; + +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.types.ResolvedRecursiveType; + +/** + * Simple helper class used to keep track of 'call stack' for classes being referenced + * (as well as unbound variables) + */ +public final class ClassStack +{ + protected final ClassStack _parent; + protected final Class _current; + + private ArrayList _selfRefs; + + public ClassStack(Class rootType) { + this(null, rootType); + } + + private ClassStack(ClassStack parent, Class curr) { + _parent = parent; + _current = curr; + } + + /** + * @return New stack frame, if addition is ok; null if not + */ + public ClassStack child(Class cls) + { + return new ClassStack(this, cls); + } + + /** + * Method called to indicate that there is a self-reference from + * deeper down in stack pointing into type this stack frame represents. + */ + public void addSelfReference(ResolvedRecursiveType ref) + { + if (_selfRefs == null) { + _selfRefs = new ArrayList(); + } + _selfRefs.add(ref); + } + + /** + * Method called when type that this stack frame represents is + * fully resolved, allowing self-references to be completed + * (if there are any) + */ + public void resolveSelfReferences(ResolvedType resolved) + { + if (_selfRefs != null) { + for (ResolvedRecursiveType ref : _selfRefs) { + ref.setReference(resolved); + } + } + } + + public ClassStack find(Class cls) + { + if (_current == cls) return this; + for (ClassStack curr = _parent; curr != null; curr = curr._parent) { + if (curr._current == cls) { + return curr; + } + } + return null; + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/util/MethodKey.java b/fine-classmate/src/com/fasterxml/classmate/util/MethodKey.java new file mode 100644 index 000000000..d8074f017 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/util/MethodKey.java @@ -0,0 +1,71 @@ +package com.fasterxml.classmate.util; + +import java.io.Serializable; + +/** + * Helper class needed when storing methods in maps. + * Immutable. + */ +@SuppressWarnings("serial") +public class MethodKey implements Serializable +{ + private static final Class[] NO_CLASSES = new Class[0]; + + private final String _name; + + private final Class[] _argumentTypes; + + private final int _hashCode; + + public MethodKey(String name) + { + _name = name; + _argumentTypes = NO_CLASSES; + _hashCode = name.hashCode(); + } + + public MethodKey(String name, Class[] argTypes) + { + _name = name; + _argumentTypes = argTypes; + _hashCode = name.hashCode() + argTypes.length; + } + + /* + /********************************************************************** + /* Standard methods + /********************************************************************** + */ + + /** + * Equality means name is the same and argument type erasures as well. + */ + @Override public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + MethodKey other = (MethodKey) o; + Class[] otherArgs = other._argumentTypes; + int len = _argumentTypes.length; + if (otherArgs.length != len) return false; + for (int i = 0; i < len; ++i) { + if (otherArgs[i] != _argumentTypes[i]) return false; + } + return _name.equals(other._name); + } + + @Override public int hashCode() { return _hashCode; } + + @Override public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append(_name); + sb.append('('); + for (int i = 0, len = _argumentTypes.length; i < len; ++i) { + if (i > 0) sb.append(','); + sb.append(_argumentTypes[i].getName()); + } + sb.append(')'); + return sb.toString(); + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/util/ResolvedTypeCache.java b/fine-classmate/src/com/fasterxml/classmate/util/ResolvedTypeCache.java new file mode 100644 index 000000000..8ce77328d --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/util/ResolvedTypeCache.java @@ -0,0 +1,141 @@ +package com.fasterxml.classmate.util; + +import java.io.Serializable; +import java.util.*; + +import com.fasterxml.classmate.ResolvedType; + +/** + * Simple LRU cache used for storing up to specified number of most recently accessed + * {@link ResolvedType} instances. + * Since usage pattern is such that caller needs synchronization, cache access methods + * are fully synchronized so that caller need not do explicit synchronization. + */ +@SuppressWarnings("serial") +public class ResolvedTypeCache implements Serializable +{ + protected final CacheMap _map; + + public ResolvedTypeCache(int maxEntries) { + _map = new CacheMap(maxEntries); + } + + /** + * Helper method for constructing reusable cache keys + */ + public Key key(Class simpleType) { + return new Key(simpleType); + } + + /** + * Helper method for constructing reusable cache keys + */ + public Key key(Class simpleType, ResolvedType[] tp) { + return new Key(simpleType, tp); + } + + public synchronized ResolvedType find(Key key) { + return _map.get(key); + } + + public synchronized int size() { + return _map.size(); + } + + public synchronized void put(Key key, ResolvedType type) { + _map.put(key, type); + } + + /* + /********************************************************************** + /* Methods for unit tests + /********************************************************************** + */ + + public void add(ResolvedType type) + { + List tp = type.getTypeParameters(); + ResolvedType[] tpa = tp.toArray(new ResolvedType[tp.size()]); + put(key(type.getErasedType(), tpa), type); + } + + /* + /********************************************************************** + /* Helper classes + /********************************************************************** + */ + + /** + * Key used for type entries. + */ + public static class Key + { + private final Class _erasedType; + + private final ResolvedType[] _typeParameters; + + private final int _hashCode; + + public Key(Class simpleType) { + this(simpleType, null); + } + + public Key(Class erasedType, ResolvedType[] tp) + { + // let's not hold on type empty arrays + if (tp != null && tp.length == 0) { + tp = null; + } + _erasedType = erasedType; + _typeParameters = tp; + int h = erasedType.getName().hashCode(); + if (tp != null) { + h += tp.length; + } + _hashCode = h; + } + + @Override + public int hashCode() { return _hashCode; } + + @Override + public boolean equals(Object o) + { + if (o == this) return true; + if (o == null || o.getClass() != getClass()) return false; + Key other = (Key) o; + if (other._erasedType != _erasedType) return false; + ResolvedType[] otherTP = other._typeParameters; + if (_typeParameters == null) { + return (otherTP == null); + } + if (otherTP == null || otherTP.length != _typeParameters.length) { + return false; + } + for (int i = 0, len = _typeParameters.length; i < len; ++i) { + if (!_typeParameters[i].equals(otherTP[i])) { + return false; + } + } + return true; + } + } + + /** + * Simple sub-class to get LRU cache + */ + private final static class CacheMap + extends LinkedHashMap + { + protected final int _maxEntries; + + public CacheMap(int maxEntries) { + _maxEntries = maxEntries; + } + + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return size() > _maxEntries; + } + } +} diff --git a/fine-classmate/src/com/fasterxml/classmate/util/package-info.java b/fine-classmate/src/com/fasterxml/classmate/util/package-info.java new file mode 100644 index 000000000..7dfc231f4 --- /dev/null +++ b/fine-classmate/src/com/fasterxml/classmate/util/package-info.java @@ -0,0 +1,4 @@ +/** + * Various utility classes used by ClassMate. + */ +package com.fasterxml.classmate.util; diff --git a/fine-druid/fine-druid.iml b/fine-druid/fine-druid.iml index 32cda9991..3ed349c5f 100644 --- a/fine-druid/fine-druid.iml +++ b/fine-druid/fine-druid.iml @@ -8,5 +8,6 @@ + \ No newline at end of file diff --git a/fine-druid/lib/hibernate-c3p0-5.1.0.Final.jar b/fine-druid/lib/hibernate-c3p0-5.1.0.Final.jar deleted file mode 100644 index 59fc32479..000000000 Binary files a/fine-druid/lib/hibernate-c3p0-5.1.0.Final.jar and /dev/null differ diff --git a/fine-druid/lib/hibernate-commons-annotations-5.0.1.Final.jar b/fine-druid/lib/hibernate-commons-annotations-5.0.1.Final.jar deleted file mode 100644 index 82e425dc2..000000000 Binary files a/fine-druid/lib/hibernate-commons-annotations-5.0.1.Final.jar and /dev/null differ diff --git a/fine-druid/lib/hibernate-core-5.1.0.Final.jar b/fine-druid/lib/hibernate-core-5.1.0.Final.jar deleted file mode 100644 index 5710607da..000000000 Binary files a/fine-druid/lib/hibernate-core-5.1.0.Final.jar and /dev/null differ diff --git a/fine-druid/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar b/fine-druid/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar deleted file mode 100644 index e2f2c5928..000000000 Binary files a/fine-druid/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar and /dev/null differ diff --git a/fine-druid/src/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java b/fine-druid/src/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java index a6e0c855b..dbec97efe 100644 --- a/fine-druid/src/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java +++ b/fine-druid/src/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java @@ -19,9 +19,9 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.Map; -import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; -import org.hibernate.service.spi.Configurable; -import org.hibernate.service.spi.Stoppable; +import com.fr.third.org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; +import com.fr.third.org.hibernate.service.spi.Configurable; +import com.fr.third.org.hibernate.service.spi.Stoppable; import com.fr.third.alibaba.druid.pool.DruidDataSource; import com.fr.third.alibaba.druid.pool.DruidDataSourceFactory; diff --git a/fine-hibernate/fine-hibernate.iml b/fine-hibernate/fine-hibernate.iml index 18e33fb9d..caf907737 100644 --- a/fine-hibernate/fine-hibernate.iml +++ b/fine-hibernate/fine-hibernate.iml @@ -10,5 +10,7 @@ + + \ No newline at end of file diff --git a/fine-hibernate/lib/classmate-1.3.0.jar b/fine-hibernate/lib/classmate-1.3.0.jar deleted file mode 100755 index 049b63fa7..000000000 Binary files a/fine-hibernate/lib/classmate-1.3.0.jar and /dev/null differ diff --git a/fine-hibernate/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar b/fine-hibernate/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar deleted file mode 100644 index e2f2c5928..000000000 Binary files a/fine-hibernate/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar and /dev/null differ diff --git a/fine-hibernate/lib/jboss-logging-annotations-2.0.1.Final.jar b/fine-hibernate/lib/jboss-logging-annotations-2.0.1.Final.jar deleted file mode 100644 index b61c6148d..000000000 Binary files a/fine-hibernate/lib/jboss-logging-annotations-2.0.1.Final.jar and /dev/null differ diff --git a/fine-hibernate/resources/META-INF/services/javax.persistence.spi.PersistenceProvider b/fine-hibernate/resources/META-INF/services/com.fr.third.javax.persistence.spi.PersistenceProvider similarity index 100% rename from fine-hibernate/resources/META-INF/services/javax.persistence.spi.PersistenceProvider rename to fine-hibernate/resources/META-INF/services/com.fr.third.javax.persistence.spi.PersistenceProvider diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/Criteria.java b/fine-hibernate/src/com/fr/third/org/hibernate/Criteria.java index 23af948b8..438e992a4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/Criteria.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/Criteria.java @@ -492,7 +492,7 @@ public interface Criteria extends CriteriaSpecification { /** - * Add a DB query hint to the SQL. These differ from JPA's {@link javax.persistence.QueryHint}, which is specific + * Add a DB query hint to the SQL. These differ from JPA's {@link com.fr.third.javax.persistence.QueryHint}, which is specific * to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the * vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will * determine concatenation and placement. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/LockMode.java b/fine-hibernate/src/com/fr/third/org/hibernate/LockMode.java index 4cdcc19a4..6827ac9bf 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/LockMode.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/LockMode.java @@ -76,7 +76,7 @@ public enum LockMode { FORCE( 15, "force" ), /** - * start of javax.persistence.LockModeType equivalent modes + * start of com.fr.third.javax.persistence.LockModeType equivalent modes */ /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/Query.java b/fine-hibernate/src/com/fr/third/org/hibernate/Query.java index 7b1ba20de..54f59a7f8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/Query.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/Query.java @@ -195,7 +195,7 @@ public interface Query extends BasicQueryContract { public Query setComment(String comment); /** - * Add a DB query hint to the SQL. These differ from JPA's {@link javax.persistence.QueryHint}, which is specific + * Add a DB query hint to the SQL. These differ from JPA's {@link com.fr.third.javax.persistence.QueryHint}, which is specific * to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the * vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will * determine concatenation and placement. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/SQLQuery.java b/fine-hibernate/src/com/fr/third/org/hibernate/SQLQuery.java index 2282c8c2c..b3c500be3 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/SQLQuery.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/SQLQuery.java @@ -55,7 +55,7 @@ public interface SQLQuery extends Query, SynchronizeableQuery { /** * Use a predefined named result-set mapping. This might be defined by a {@code } element in a - * Hibernate hbm.xml file or through a {@link javax.persistence.SqlResultSetMapping} annotation. + * Hibernate hbm.xml file or through a {@link com.fr.third.javax.persistence.SqlResultSetMapping} annotation. * * @param name The name of the mapping to use. * @@ -80,7 +80,7 @@ public interface SQLQuery extends Query, SynchronizeableQuery { /** * Declare a scalar query result. Hibernate will attempt to automatically detect the underlying type. *

- * Functions like {@code } in {@code hbm.xml} or {@link javax.persistence.ColumnResult} + * Functions like {@code } in {@code hbm.xml} or {@link com.fr.third.javax.persistence.ColumnResult} * * @param columnAlias The column alias in the result-set to be processed as a scalar result * @@ -91,7 +91,7 @@ public interface SQLQuery extends Query, SynchronizeableQuery { /** * Declare a scalar query result. *

- * Functions like {@code } in {@code hbm.xml} or {@link javax.persistence.ColumnResult} + * Functions like {@code } in {@code hbm.xml} or {@link com.fr.third.javax.persistence.ColumnResult} * * @param columnAlias The column alias in the result-set to be processed as a scalar result * @param type The Hibernate type as which to treat the value. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/SharedSessionContract.java b/fine-hibernate/src/com/fr/third/org/hibernate/SharedSessionContract.java index 986cb03c2..f40424180 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/SharedSessionContract.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/SharedSessionContract.java @@ -76,7 +76,7 @@ public interface SharedSessionContract extends Serializable { * * @return The ProcedureCall * - * @see javax.persistence.NamedStoredProcedureQuery + * @see com.fr.third.javax.persistence.NamedStoredProcedureQuery */ public ProcedureCall getNamedProcedureCall(String name); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AccessType.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AccessType.java index 63b8f5e44..1b94a301c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AccessType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AccessType.java @@ -15,13 +15,13 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Property Access type. Prefer the standard {@link javax.persistence.Access} annotation; however, + * Property Access type. Prefer the standard {@link com.fr.third.javax.persistence.Access} annotation; however, * {@code @Access} is limited to field/property access definitions. * * @author Emmanuel Bernard * * @deprecated Use {@link AttributeAccessor} instead; renamed to avoid confusion with the JPA - * {@link javax.persistence.AccessType} enum. + * {@link com.fr.third.javax.persistence.AccessType} enum. */ @Target({ TYPE, METHOD, FIELD }) @Retention(RUNTIME) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Any.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Any.java index 458e42484..d61c828af 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Any.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Any.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.annotations; import java.lang.annotation.Retention; -import javax.persistence.Column; -import javax.persistence.FetchType; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.FetchType; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AttributeAccessor.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AttributeAccessor.java index 71ca20c50..91f65f7cb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AttributeAccessor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/AttributeAccessor.java @@ -27,10 +27,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * * Should only be used to name custom {@link com.fr.third.org.hibernate.property.access.spi.PropertyAccessStrategy}. For - * {@code property/field} access, the JPA {@link javax.persistence.Access} annotation should be preferred - * using the appropriate {@link javax.persistence.AccessType}. However, if this annotation is used with + * {@code property/field} access, the JPA {@link com.fr.third.javax.persistence.Access} annotation should be preferred + * using the appropriate {@link com.fr.third.javax.persistence.AccessType}. However, if this annotation is used with * either {@code value="property"} or {@code value="field"}, it will act just as the corresponding usage - * of {@link javax.persistence.Access}. + * of {@link com.fr.third.javax.persistence.Access}. * * @see com.fr.third.org.hibernate.property.access.spi.PropertyAccessStrategy * @see com.fr.third.org.hibernate.property.access.spi.PropertyAccessStrategyResolver diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Cascade.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Cascade.java index 74fa0b97a..32219226a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Cascade.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Cascade.java @@ -14,8 +14,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Apply a cascade strategy on an association. Used to apply Hibernate specific cascades. For JPA cascading, prefer - * using {@link javax.persistence.CascadeType} on {@link javax.persistence.OneToOne}, - * {@link javax.persistence.OneToMany}, etc. Hibernate will merge together both sets of cascades. + * using {@link com.fr.third.javax.persistence.CascadeType} on {@link com.fr.third.javax.persistence.OneToOne}, + * {@link com.fr.third.javax.persistence.OneToMany}, etc. Hibernate will merge together both sets of cascades. * * @author Emmanuel Bernard * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CascadeType.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CascadeType.java index 8c9cac545..70cd30991 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CascadeType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CascadeType.java @@ -15,19 +15,19 @@ public enum CascadeType { */ ALL, /** - * Corresponds to {@link javax.persistence.CascadeType#PERSIST}. + * Corresponds to {@link com.fr.third.javax.persistence.CascadeType#PERSIST}. */ PERSIST, /** - * Corresponds to {@link javax.persistence.CascadeType#MERGE}. + * Corresponds to {@link com.fr.third.javax.persistence.CascadeType#MERGE}. */ MERGE, /** - * Corresponds to {@link javax.persistence.CascadeType#REMOVE}. + * Corresponds to {@link com.fr.third.javax.persistence.CascadeType#REMOVE}. */ REMOVE, /** - * Corresponds to {@link javax.persistence.CascadeType#REFRESH}. + * Corresponds to {@link com.fr.third.javax.persistence.CascadeType#REFRESH}. */ REFRESH, /** @@ -56,12 +56,12 @@ public enum CascadeType { /** * JPA originally planned on calling DETACH EVICT. * - * @deprecated use javax.persistence.CascadeType.DETACH + * @deprecated use com.fr.third.javax.persistence.CascadeType.DETACH */ @Deprecated EVICT, /** - * Corresponds to {@link javax.persistence.CascadeType#REFRESH}. + * Corresponds to {@link com.fr.third.javax.persistence.CascadeType#REFRESH}. */ DETACH } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CollectionId.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CollectionId.java index d174e3a08..65e6fd8ec 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CollectionId.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/CollectionId.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.annotations; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.persistence.Column; +import com.fr.third.javax.persistence.Column; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Columns.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Columns.java index 36603c861..7befaefe0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Columns.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Columns.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.annotations; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.persistence.Column; +import com.fr.third.javax.persistence.Column; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/DiscriminatorFormula.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/DiscriminatorFormula.java index f28f2926b..53e05fe58 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/DiscriminatorFormula.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/DiscriminatorFormula.java @@ -14,7 +14,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Used to apply a Hibernate formula (derived value) as the inheritance discriminator "column". Used in place of - * the JPA {@link javax.persistence.DiscriminatorColumn} when a formula is wanted. + * the JPA {@link com.fr.third.javax.persistence.DiscriminatorColumn} when a formula is wanted. * * To be placed on the root entity. * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Entity.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Entity.java index 98fdc2528..987f67b12 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Entity.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Entity.java @@ -13,7 +13,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Extends {@link javax.persistence.Entity} with Hibernate features. + * Extends {@link com.fr.third.javax.persistence.Entity} with Hibernate features. * * @author Emmanuel Bernard * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FetchMode.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FetchMode.java index a140a11c8..acf3ce441 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FetchMode.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FetchMode.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.annotations; /** - * Fetch options on associations. Defines more of the "how" of fetching, whereas JPA {@link javax.persistence.FetchType} + * Fetch options on associations. Defines more of the "how" of fetching, whereas JPA {@link com.fr.third.javax.persistence.FetchType} * focuses on the "when". * * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FlushModeType.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FlushModeType.java index ce9582b66..5988c7f5a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FlushModeType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/FlushModeType.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.annotations; /** - * Enumeration extending javax.persistence flush modes. + * Enumeration extending com.fr.third.javax.persistence flush modes. * * @author Carlos Gonz�lez-Cadenas */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ForeignKey.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ForeignKey.java index 4ec5d7164..2e709b5bd 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ForeignKey.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ForeignKey.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Define the foreign key name. * - * @deprecated Prefer the JPA 2.1 introduced {@link javax.persistence.ForeignKey} instead. + * @deprecated Prefer the JPA 2.1 introduced {@link com.fr.third.javax.persistence.ForeignKey} instead. */ @Target({FIELD, METHOD, TYPE}) @Retention(RUNTIME) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Index.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Index.java index 2d36714dc..573cb1023 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Index.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Index.java @@ -17,7 +17,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * @author Emmanuel Bernard * - * @deprecated Using {@link javax.persistence.Index} instead. + * @deprecated Using {@link com.fr.third.javax.persistence.Index} instead. */ @Target({FIELD, METHOD}) @Retention(RUNTIME) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/IndexColumn.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/IndexColumn.java index b00a78aac..85c53875f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/IndexColumn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/IndexColumn.java @@ -18,7 +18,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * @author Matthew Inger * - * @deprecated Prefer the standard JPA {@link javax.persistence.OrderColumn} annotation and the Hibernate specific + * @deprecated Prefer the standard JPA {@link com.fr.third.javax.persistence.OrderColumn} annotation and the Hibernate specific * {@link ListIndexBase} (for replacing {@link #base()}). */ @Target({METHOD, FIELD}) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/JoinColumnOrFormula.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/JoinColumnOrFormula.java index 92f09fcec..bad47bbb3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/JoinColumnOrFormula.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/JoinColumnOrFormula.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.annotations; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinColumn; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ListIndexBase.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ListIndexBase.java index 19b6ea3f7..4652b6f91 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ListIndexBase.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ListIndexBase.java @@ -17,9 +17,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * By default list indexes are stored starting at zero. * - * Generally used in conjunction with {@link javax.persistence.OrderColumn}. + * Generally used in conjunction with {@link com.fr.third.javax.persistence.OrderColumn}. * - * @see javax.persistence.OrderColumn + * @see com.fr.third.javax.persistence.OrderColumn * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ManyToAny.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ManyToAny.java index 30323aceb..6252b1769 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ManyToAny.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/ManyToAny.java @@ -7,8 +7,8 @@ package com.fr.third.org.hibernate.annotations; import java.lang.annotation.Retention; -import javax.persistence.Column; -import javax.persistence.FetchType; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.FetchType; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQueries.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQueries.java index 4da68f3ce..9f0c150c6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQueries.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQueries.java @@ -14,7 +14,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * A grouping of Hibernate-specific {@link NamedNativeQuery} definitions. Effectively extends the named native - * query definitions made available through {@link javax.persistence.NamedNativeQueries}. + * query definitions made available through {@link com.fr.third.javax.persistence.NamedNativeQueries}. * * @author Emmanuel Bernard */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQuery.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQuery.java index 3203b44b6..e847d1a10 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQuery.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedNativeQuery.java @@ -13,7 +13,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Extends {@link javax.persistence.NamedNativeQuery} with Hibernate features. + * Extends {@link com.fr.third.javax.persistence.NamedNativeQuery} with Hibernate features. * * @author Emmanuel Bernard * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQueries.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQueries.java index 4c3003938..281314b39 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQueries.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQueries.java @@ -14,7 +14,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * A grouping of Hibernate-specific {@link NamedQuery} definitions. Effectively extends the named query - * definitions made available through {@link javax.persistence.NamedQueries}. + * definitions made available through {@link com.fr.third.javax.persistence.NamedQueries}. * * @author Emmanuel Bernard * @author Carlos Gonz�lez-Cadenas diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQuery.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQuery.java index 0bb042040..f8fc72dba 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQuery.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/NamedQuery.java @@ -14,7 +14,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Extends {@link javax.persistence.NamedQuery} with Hibernate features. + * Extends {@link com.fr.third.javax.persistence.NamedQuery} with Hibernate features. * * @author Carlos Gonzalez-Cadenas * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OptimisticLockType.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OptimisticLockType.java index 3237fe16a..fd8a43b2b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OptimisticLockType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OptimisticLockType.java @@ -19,7 +19,7 @@ public enum OptimisticLockType { /** * Perform optimistic locking using a dedicated version column. * - * @see javax.persistence.Version + * @see com.fr.third.javax.persistence.Version */ VERSION, /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OrderBy.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OrderBy.java index dcf9f6a7c..8c3ffcce6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OrderBy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/OrderBy.java @@ -15,13 +15,13 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Order a collection using SQL ordering (not HQL ordering). * - * Different from {@link javax.persistence.OrderBy} in that this expects SQL fragment, JPA OrderBy expects a + * Different from {@link com.fr.third.javax.persistence.OrderBy} in that this expects SQL fragment, JPA OrderBy expects a * valid JPQL order-by fragment. * * @author Emmanuel Bernard * @author Steve Ebersole * - * @see javax.persistence.OrderBy + * @see com.fr.third.javax.persistence.OrderBy * @see SortComparator * @see SortNatural */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/QueryHints.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/QueryHints.java index 8cf36dd07..f3b86fa64 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/QueryHints.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/QueryHints.java @@ -91,13 +91,13 @@ public class QueryHints { /** * Apply a JPA query timeout, which is defined in milliseconds. */ - public static final String TIMEOUT_JPA = "javax.persistence.query.timeout"; + public static final String TIMEOUT_JPA = "com.fr.third.javax.persistence.query.timeout"; /** * Available to apply lock mode to a native SQL query since JPA requires that - * {@link javax.persistence.Query#setLockMode} throw an IllegalStateException if called for a native query. + * {@link com.fr.third.javax.persistence.Query#setLockMode} throw an IllegalStateException if called for a native query. *

- * Accepts a {@link javax.persistence.LockModeType} or a {@link com.fr.third.org.hibernate.LockMode} + * Accepts a {@link com.fr.third.javax.persistence.LockModeType} or a {@link com.fr.third.org.hibernate.LockMode} */ public static final String NATIVE_LOCKMODE = "com.fr.third.org.hibernate.lockMode"; @@ -108,13 +108,13 @@ public class QueryHints { * Note: Currently, attributes that are not specified are treated as FetchType.LAZY or FetchType.EAGER depending * on the attribute's definition in metadata, rather than forcing FetchType.LAZY. */ - public static final String FETCHGRAPH = "javax.persistence.fetchgraph"; + public static final String FETCHGRAPH = "com.fr.third.javax.persistence.fetchgraph"; /** * Hint providing a "loadgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as * FetchType.EAGER (via join fetch or subsequent select). Attributes that are not specified are treated as * FetchType.LAZY or FetchType.EAGER depending on the attribute's definition in metadata */ - public static final String LOADGRAPH = "javax.persistence.loadgraph"; + public static final String LOADGRAPH = "com.fr.third.javax.persistence.loadgraph"; } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Source.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Source.java index eebf3e934..5bc5162e4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Source.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/Source.java @@ -14,7 +14,7 @@ import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Optional annotation in conjunction with {@link javax.persistence.Version} and timestamp version properties + * Optional annotation in conjunction with {@link com.fr.third.javax.persistence.Version} and timestamp version properties * indicating the source of the timestamp value. * * @author Hardy Ferentschik diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/annotationfactory/AnnotationFactory.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/annotationfactory/AnnotationFactory.java index 4b78c34cc..4028c281c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/annotationfactory/AnnotationFactory.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/annotationfactory/AnnotationFactory.java @@ -39,8 +39,8 @@ public class AnnotationFactory { * Creates an Annotation proxy for the given annotation descriptor. *

* NOTE: the proxy here is generated using the ClassLoader of the Annotation type's Class. E.g., - * if asked to create an Annotation proxy for javax.persistence.Entity we would use the ClassLoader - * of the javax.persistence.Entity Class for generating the proxy. + * if asked to create an Annotation proxy for com.fr.third.javax.persistence.Entity we would use the ClassLoader + * of the com.fr.third.javax.persistence.Entity Class for generating the proxy. * * @param descriptor The annotation descriptor * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/util/impl/Log.java b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/util/impl/Log.java index 51db00f7c..ed9e650b5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/util/impl/Log.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/annotations/common/util/impl/Log.java @@ -21,10 +21,10 @@ package com.fr.third.org.hibernate.annotations.common.util.impl; import com.fr.third.org.jboss.logging.BasicLogger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.Cause; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; import static com.fr.third.org.jboss.logging.Logger.Level.ERROR; import static com.fr.third.org.jboss.logging.Logger.Level.INFO; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/MetadataBuilder.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/MetadataBuilder.java index 3174abf49..1395e1c98 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/MetadataBuilder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/MetadataBuilder.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.boot; -import javax.persistence.AttributeConverter; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.SharedCacheMode; import com.fr.third.org.hibernate.annotations.common.reflection.ReflectionManager; import com.fr.third.org.hibernate.boot.archive.scan.spi.ScanEnvironment; @@ -112,7 +112,7 @@ public interface MetadataBuilder { * Specify the second-level cache mode to be used. This is the cache mode in terms of whether or * not to cache. *

- * Its default is defined by the {@coce javax.persistence.sharedCache.mode} setting if using + * Its default is defined by the {@coce com.fr.third.javax.persistence.sharedCache.mode} setting if using * property-based configuration. * * @param cacheMode The cache mode. @@ -135,7 +135,7 @@ public interface MetadataBuilder { * @return {@code this}, for method chaining * * @see com.fr.third.org.hibernate.cfg.AvailableSettings#DEFAULT_CACHE_CONCURRENCY_STRATEGY - * @see #applySharedCacheMode(javax.persistence.SharedCacheMode) + * @see #applySharedCacheMode(com.fr.third.javax.persistence.SharedCacheMode) */ MetadataBuilder applyAccessType(AccessType accessType); @@ -205,10 +205,10 @@ public interface MetadataBuilder { /** * Should we enable support for the "new" (since 3.2) identifier generator mappings for * handling:

*

* Its default is defined by the {@link com.fr.third.org.hibernate.cfg.AvailableSettings#USE_NEW_ID_GENERATOR_MAPPINGS} @@ -364,7 +364,7 @@ public interface MetadataBuilder { * Ideally we should avoid accessing ClassLoaders when perform 1st phase of bootstrap. This * is a ClassLoader that can be used in cases when we have to. IN EE managed environments, this * is the ClassLoader mandated by - * {@link javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}. This ClassLoader + * {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}. This ClassLoader * is thrown away by the container afterwards. The idea being that the Class can still be enhanced * in the application ClassLoader. In other environments, pass a ClassLoader that performs the * same function if desired. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java index 73c3bf3b4..b633cb741 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/archive/scan/spi/ClassFileArchiveEntryHandler.java @@ -9,10 +9,10 @@ package com.fr.third.org.hibernate.boot.archive.scan.spi; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; -import javax.persistence.Converter; -import javax.persistence.Embeddable; -import javax.persistence.Entity; -import javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.Converter; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.MappedSuperclass; import javassist.bytecode.AnnotationsAttribute; import javassist.bytecode.ClassFile; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorImpl.java index ee68ff92e..a4dbc3217 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorImpl.java @@ -12,7 +12,7 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.List; import java.util.Map; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.HibernateException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorNonAutoApplicableImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorNonAutoApplicableImpl.java index 055129e6d..4e51d707a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorNonAutoApplicableImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/AttributeConverterDescriptorNonAutoApplicableImpl.java @@ -12,7 +12,7 @@ import java.lang.reflect.TypeVariable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/IdGeneratorInterpreterImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/IdGeneratorInterpreterImpl.java index f59e6624a..f0fed9ca8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/IdGeneratorInterpreterImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/IdGeneratorInterpreterImpl.java @@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.boot.internal; import java.util.ArrayList; import java.util.UUID; -import javax.persistence.GenerationType; -import javax.persistence.SequenceGenerator; -import javax.persistence.TableGenerator; +import com.fr.third.javax.persistence.GenerationType; +import com.fr.third.javax.persistence.SequenceGenerator; +import com.fr.third.javax.persistence.TableGenerator; import com.fr.third.org.hibernate.boot.model.IdGeneratorStrategyInterpreter; import com.fr.third.org.hibernate.boot.model.IdentifierGeneratorDefinition; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java index 33a6302c0..d66aee200 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java @@ -18,10 +18,10 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.AttributeConverter; -import javax.persistence.Embeddable; -import javax.persistence.Entity; -import javax.persistence.MapsId; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.MapsId; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; @@ -1031,7 +1031,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector else if ( clazz.isAnnotationPresent( Embeddable.class ) ) { type = AnnotatedClassType.EMBEDDABLE; } - else if ( clazz.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) { + else if ( clazz.isAnnotationPresent( com.fr.third.javax.persistence.MappedSuperclass.class ) ) { type = AnnotatedClassType.EMBEDDABLE_SUPERCLASS; } else { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/MetadataBuilderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/MetadataBuilderImpl.java index 4ca4263b4..6b2d0209b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/MetadataBuilderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/MetadataBuilderImpl.java @@ -13,8 +13,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; -import javax.persistence.AttributeConverter; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.SharedCacheMode; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.HibernateException; @@ -620,7 +620,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont ); this.sharedCacheMode = configService.getSetting( - "javax.persistence.sharedCache.mode", + "com.fr.third.javax.persistence.sharedCache.mode", new ConfigurationService.Converter() { @Override public SharedCacheMode convert(Object value) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java index 82105c687..57a874a82 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java @@ -526,8 +526,8 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement cfgService = new ConfigurationServiceImpl( configurationSettings ); ( (ConfigurationServiceImpl) cfgService ).injectServices( (ServiceRegistryImplementor) serviceRegistry ); - this.beanManagerReference = configurationSettings.get( "javax.persistence.bean.manager" ); - this.validatorFactoryReference = configurationSettings.get( "javax.persistence.validation.factory" ); + this.beanManagerReference = configurationSettings.get( "com.fr.third.javax.persistence.bean.manager" ); + this.validatorFactoryReference = configurationSettings.get( "com.fr.third.javax.persistence.validation.factory" ); this.sessionFactoryName = (String) configurationSettings.get( SESSION_FACTORY_NAME ); this.sessionFactoryNameAlsoJndiName = cfgService.getSetting( diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/IdGeneratorStrategyInterpreter.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/IdGeneratorStrategyInterpreter.java index c1f37a8af..fda7a3d9e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/IdGeneratorStrategyInterpreter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/IdGeneratorStrategyInterpreter.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.boot.model; -import javax.persistence.GenerationType; -import javax.persistence.SequenceGenerator; -import javax.persistence.TableGenerator; +import com.fr.third.javax.persistence.GenerationType; +import com.fr.third.javax.persistence.SequenceGenerator; +import com.fr.third.javax.persistence.TableGenerator; /** * Strategy for interpreting identifier generator related information. @@ -25,7 +25,7 @@ public interface IdGeneratorStrategyInterpreter { * GenerationType, returning {@code null} to indicate that this interpreter * did not have a match and that any additional resolutions should be performed. * - * @param generationType The {@link javax.persistence.GeneratedValue#strategy} value + * @param generationType The {@link com.fr.third.javax.persistence.GeneratedValue#strategy} value * @param context The context for resolution (method parameter object) */ String determineGeneratorName(GenerationType generationType, GeneratorNameDeterminationContext context); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/EntityNaming.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/EntityNaming.java index 0280d64ea..e639424eb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/EntityNaming.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/EntityNaming.java @@ -31,7 +31,7 @@ public interface EntityNaming { public String getEntityName(); /** - * The JPA-specific entity name. See {@link javax.persistence.Entity#name()} for details. + * The JPA-specific entity name. See {@link com.fr.third.javax.persistence.Entity#name()} for details. * * @return The JPA entity name, if one was specified. May return {@code null} if one * was not explicitly specified. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitBasicColumnNameSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitBasicColumnNameSource.java index d881ecaba..153562a63 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitBasicColumnNameSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitBasicColumnNameSource.java @@ -13,7 +13,7 @@ import com.fr.third.org.hibernate.boot.model.source.spi.AttributePath; * * @author Steve Ebersole * - * @see javax.persistence.Column + * @see com.fr.third.javax.persistence.Column */ public interface ImplicitBasicColumnNameSource extends ImplicitNameSource { /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitCollectionTableNameSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitCollectionTableNameSource.java index b6b8eb825..3ae4d6153 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitCollectionTableNameSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitCollectionTableNameSource.java @@ -13,7 +13,7 @@ import com.fr.third.org.hibernate.boot.model.source.spi.AttributePath; * * @author Steve Ebersole * - * @see javax.persistence.CollectionTable + * @see com.fr.third.javax.persistence.CollectionTable */ public interface ImplicitCollectionTableNameSource extends ImplicitNameSource { /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinColumnNameSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinColumnNameSource.java index 493ef5fe0..ae0ad45a5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinColumnNameSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinColumnNameSource.java @@ -10,11 +10,11 @@ import com.fr.third.org.hibernate.boot.model.source.spi.AttributePath; /** * Context for determining the implicit name of a "join column" (think - * {@link javax.persistence.JoinColumn}). + * {@link com.fr.third.javax.persistence.JoinColumn}). * * @author Steve Ebersole * - * @see javax.persistence.JoinColumn + * @see com.fr.third.javax.persistence.JoinColumn */ public interface ImplicitJoinColumnNameSource extends ImplicitNameSource { public static enum Nature { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinTableNameSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinTableNameSource.java index c32bb4069..d19d72876 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinTableNameSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitJoinTableNameSource.java @@ -13,7 +13,7 @@ import com.fr.third.org.hibernate.boot.model.source.spi.AttributePath; * * @author Steve Ebersole * - * @see javax.persistence.JoinTable + * @see com.fr.third.javax.persistence.JoinTable */ public interface ImplicitJoinTableNameSource extends ImplicitNameSource { /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitMapKeyColumnNameSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitMapKeyColumnNameSource.java index 3b3311063..af89f718a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitMapKeyColumnNameSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitMapKeyColumnNameSource.java @@ -11,13 +11,13 @@ import com.fr.third.org.hibernate.boot.model.source.spi.AttributePath; /** * Context for determining the implicit name of a column used to back the key * of a {@link java.util.Map}. This is used for both - * {@link javax.persistence.MapKeyColumn} and - * {@link javax.persistence.MapKeyJoinColumn} cases. + * {@link com.fr.third.javax.persistence.MapKeyColumn} and + * {@link com.fr.third.javax.persistence.MapKeyJoinColumn} cases. * * @author Steve Ebersole * - * @see javax.persistence.MapKeyColumn - * @see javax.persistence.MapKeyJoinColumn + * @see com.fr.third.javax.persistence.MapKeyColumn + * @see com.fr.third.javax.persistence.MapKeyJoinColumn */ public interface ImplicitMapKeyColumnNameSource extends ImplicitNameSource { /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitNamingStrategy.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitNamingStrategy.java index 456b489e6..834293d2e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitNamingStrategy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ImplicitNamingStrategy.java @@ -18,10 +18,10 @@ package com.fr.third.org.hibernate.boot.model.naming; *

  • * Entity primary table - {@link #determinePrimaryTableName}. Used when the * primary table for an entity is not explicitly named in the metadata. See - * {@link javax.persistence.Table} for details. + * {@link com.fr.third.javax.persistence.Table} for details. *
  • *
  • - * Join table - {@link #determineJoinTableName}. See {@link javax.persistence.JoinTable} + * Join table - {@link #determineJoinTableName}. See {@link com.fr.third.javax.persistence.JoinTable} * for details. Join table covers basically any entity association whether in the form * of a collection of entities (one-to-many, many-to-many) or a singular entity association * (many-to-one, and occasionally one-to-one). @@ -29,7 +29,7 @@ package com.fr.third.org.hibernate.boot.model.naming; *
  • * Collection table - {@link #determineCollectionTableName} - Collection table * refers to any non-entity collection (basic, component/embeddable, any). See - * {@link javax.persistence.CollectionTable} for details. + * {@link com.fr.third.javax.persistence.CollectionTable} for details. *
  • *
  • * Notice that secondary tables are not mentioned, since they must always be explicitly named @@ -114,7 +114,7 @@ public interface ImplicitNamingStrategy { public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source); /** - * Determine the column name related to {@link javax.persistence.JoinColumn}. In + * Determine the column name related to {@link com.fr.third.javax.persistence.JoinColumn}. In * {@code hbm.xml} terms, this would be a {@code } defined for a collection * or the column associated with a many-to-one. * @@ -125,7 +125,7 @@ public interface ImplicitNamingStrategy { public Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source); /** - * Determine the column name related to {@link javax.persistence.PrimaryKeyJoinColumn}. In + * Determine the column name related to {@link com.fr.third.javax.persistence.PrimaryKeyJoinColumn}. In * {@code hbm.xml} terms, this would be a {@code } defined for a {@code } * or a {@code } (others?) * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ObjectNameNormalizer.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ObjectNameNormalizer.java index 5f56b180a..8aca80f24 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ObjectNameNormalizer.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/naming/ObjectNameNormalizer.java @@ -95,8 +95,8 @@ public abstract class ObjectNameNormalizer { /** * Intended only for use in handling quoting requirements for {@code column-definition} - * as defined by {@link javax.persistence.Column#columnDefinition()}, - * {@link javax.persistence.JoinColumn#columnDefinition}, etc. This method should not + * as defined by {@link com.fr.third.javax.persistence.Column#columnDefinition()}, + * {@link com.fr.third.javax.persistence.JoinColumn#columnDefinition}, etc. This method should not * be called in any other scenario. * * @param text The specified column definition diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/process/internal/ScanningCoordinator.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/process/internal/ScanningCoordinator.java index cf0aafe10..0e07f5fa4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/process/internal/ScanningCoordinator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/process/internal/ScanningCoordinator.java @@ -12,7 +12,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.boot.MappingException; import com.fr.third.org.hibernate.boot.archive.internal.StandardArchiveDescriptorFactory; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/internal/annotations/AnnotationMetadataSourceProcessorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/internal/annotations/AnnotationMetadataSourceProcessorImpl.java index fab0bac0e..0b2fe1fd9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/internal/annotations/AnnotationMetadataSourceProcessorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/internal/annotations/AnnotationMetadataSourceProcessorImpl.java @@ -11,10 +11,10 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.persistence.Entity; -import javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.Converter; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.MappedSuperclass; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.annotations.common.reflection.ClassLoadingException; @@ -268,7 +268,7 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc && !reflectionManager.equals( superClass, Object.class ) && !copy.contains( superClass ) ) { if ( superClass.isAnnotationPresent( Entity.class ) - || superClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) { + || superClass.isAnnotationPresent( com.fr.third.javax.persistence.MappedSuperclass.class ) ) { copy.add( superClass ); } superClass = superClass.getSuperclass(); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/CompositeIdentifierSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/CompositeIdentifierSource.java index 712930755..72bfbcf7e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/CompositeIdentifierSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/CompositeIdentifierSource.java @@ -10,8 +10,8 @@ import com.fr.third.org.hibernate.boot.model.IdentifierGeneratorDefinition; /** * Common contract for composite identifiers. Specific sub-types include aggregated - * (think {@link javax.persistence.EmbeddedId}) and non-aggregated (think - * {@link javax.persistence.IdClass}). + * (think {@link com.fr.third.javax.persistence.EmbeddedId}) and non-aggregated (think + * {@link com.fr.third.javax.persistence.IdClass}). * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifiableTypeSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifiableTypeSource.java index e4704521d..4ce7b25c3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifiableTypeSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifiableTypeSource.java @@ -13,7 +13,7 @@ import com.fr.third.org.hibernate.boot.jaxb.Origin; /** * Common contract between Entity and MappedSuperclass sources. The - * terminology is taken from JPA's {@link javax.persistence.metamodel.IdentifiableType} + * terminology is taken from JPA's {@link com.fr.third.javax.persistence.metamodel.IdentifiableType} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceAggregatedComposite.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceAggregatedComposite.java index 1862dd25c..b7abcced9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceAggregatedComposite.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceAggregatedComposite.java @@ -14,7 +14,7 @@ import java.util.List; * {@link com.fr.third.org.hibernate.id.EntityIdentifierNature#AGGREGATED_COMPOSITE}. *

    * This equates to an identifier which is made up of multiple values which are - * defined as part of a component/embedded; i.e. {@link javax.persistence.EmbeddedId} + * defined as part of a component/embedded; i.e. {@link com.fr.third.javax.persistence.EmbeddedId} * * @author Strong Liu * @author Steve Ebersole @@ -28,7 +28,7 @@ public interface IdentifierSourceAggregatedComposite extends CompositeIdentifier public SingularAttributeSourceEmbedded getIdentifierAttributeSource(); /** - * Obtain the mapping of attributes annotated with {@link javax.persistence.MapsId}. + * Obtain the mapping of attributes annotated with {@link com.fr.third.javax.persistence.MapsId}. * * @return The MapsId sources. */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceNonAggregatedComposite.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceNonAggregatedComposite.java index 68e0c1ddf..4ccf8cc8e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceNonAggregatedComposite.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/IdentifierSourceNonAggregatedComposite.java @@ -12,7 +12,7 @@ import java.util.List; * Additional contract describing the source of an identifier mapping whose {@link #getNature() nature} is * {@link com.fr.third.org.hibernate.id.EntityIdentifierNature#NON_AGGREGATED_COMPOSITE }. *

    - * Think {@link javax.persistence.IdClass} + * Think {@link com.fr.third.javax.persistence.IdClass} * * @author Steve Ebersole */ @@ -25,7 +25,7 @@ public interface IdentifierSourceNonAggregatedComposite extends CompositeIdentif public List getAttributeSourcesMakingUpIdentifier(); /** - * Retrieve the source information for the {@link javax.persistence.IdClass} definition + * Retrieve the source information for the {@link com.fr.third.javax.persistence.IdClass} definition * * @return The IdClass source information, or {@code null} if none. */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/JpaCallbackSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/JpaCallbackSource.java index 4fa3aa3a3..57147dab3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/JpaCallbackSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/JpaCallbackSource.java @@ -14,22 +14,22 @@ import java.lang.annotation.Annotation; public interface JpaCallbackSource { /** - * @param callbackType {@link javax.persistence.PrePersist}, {@link javax.persistence.PreRemove}, {@link javax.persistence.PreUpdate}, {@link javax.persistence.PostLoad}, - * {@link javax.persistence.PostPersist}, {@link javax.persistence.PostRemove}, or {@link javax.persistence.PostUpdate} - * @return the name of the JPA callback method defined for the associated {@link javax.persistence.Entity entity} or {@link javax.persistence.MappedSuperclass + * @param callbackType {@link com.fr.third.javax.persistence.PrePersist}, {@link com.fr.third.javax.persistence.PreRemove}, {@link com.fr.third.javax.persistence.PreUpdate}, {@link com.fr.third.javax.persistence.PostLoad}, + * {@link com.fr.third.javax.persistence.PostPersist}, {@link com.fr.third.javax.persistence.PostRemove}, or {@link com.fr.third.javax.persistence.PostUpdate} + * @return the name of the JPA callback method defined for the associated {@link com.fr.third.javax.persistence.Entity entity} or {@link com.fr.third.javax.persistence.MappedSuperclass * mapped superclass} and for the supplied callback annotation class. */ String getCallbackMethod(Class callbackType); /** - * @return the name of the instantiated container where the JPA callbacks for the associated {@link javax.persistence.Entity entity} or - * {@link javax.persistence.MappedSuperclass mapped superclass} are defined. This can be either the entity/mapped superclass itself or an - * {@link javax.persistence.EntityListeners entity listener}. + * @return the name of the instantiated container where the JPA callbacks for the associated {@link com.fr.third.javax.persistence.Entity entity} or + * {@link com.fr.third.javax.persistence.MappedSuperclass mapped superclass} are defined. This can be either the entity/mapped superclass itself or an + * {@link com.fr.third.javax.persistence.EntityListeners entity listener}. */ String getName(); /** - * @return true if this callback class represents callbacks defined within an {@link javax.persistence.EntityListeners entity + * @return true if this callback class represents callbacks defined within an {@link com.fr.third.javax.persistence.EntityListeners entity * listener}. */ boolean isListener(); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/MapsIdSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/MapsIdSource.java index 995b50ad2..76397c46b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/MapsIdSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/MapsIdSource.java @@ -7,13 +7,13 @@ package com.fr.third.org.hibernate.boot.model.source.spi; /** - * Describes a relationship annotated with {@link javax.persistence.MapsId} + * Describes a relationship annotated with {@link com.fr.third.javax.persistence.MapsId} * * @author Steve Ebersole */ public interface MapsIdSource { /** - * Obtain the {@link javax.persistence.MapsId#value()} naming the attribute + * Obtain the {@link com.fr.third.javax.persistence.MapsId#value()} naming the attribute * within the EmbeddedId mapped by this relationship. * * @return The corresponding id attribute name. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/Orderable.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/Orderable.java index 6171497ed..d7e5b4e6c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/Orderable.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/Orderable.java @@ -26,7 +26,7 @@ public interface Orderable { * If the ordering element is not specified, ordering by * the primary key of the associated entity is assumed * - * {@see javax.persistence.OrderBy#value()} + * {@see com.fr.third.javax.persistence.OrderBy#value()} * * @return The {@code ORDER BY} fragment used during loading this plural attribute from DB. */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/PluralAttributeMapKeySource.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/PluralAttributeMapKeySource.java index d88080638..a8c8ca1df 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/PluralAttributeMapKeySource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/model/source/spi/PluralAttributeMapKeySource.java @@ -20,7 +20,7 @@ package com.fr.third.org.hibernate.boot.model.source.spi; * *

    * {@link PluralAttributeMapKeySourceEntityAttribute} is only relevant from - * annotations when using {@link javax.persistence.MapKey}. + * annotations when using {@link com.fr.third.javax.persistence.MapKey}. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java index 9c36931c0..e4d70d436 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuilderImplementor.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.boot.spi; -import javax.persistence.AttributeConverter; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.SharedCacheMode; import com.fr.third.org.hibernate.annotations.common.reflection.ReflectionManager; import com.fr.third.org.hibernate.boot.CacheRegionDefinition; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java index 831b76a93..d0b5f91b5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AbstractDelegatingMetadataBuildingOptions.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.boot.spi; import java.util.List; import java.util.Map; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.SharedCacheMode; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.MultiTenancyStrategy; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AttributeConverterDescriptor.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AttributeConverterDescriptor.java index 06f87eb16..478937e7a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AttributeConverterDescriptor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/AttributeConverterDescriptor.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.boot.spi; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.annotations.common.reflection.XProperty; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/InFlightMetadataCollector.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/InFlightMetadataCollector.java index 1149f85ac..a20a93600 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/InFlightMetadataCollector.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/InFlightMetadataCollector.java @@ -10,7 +10,7 @@ import java.io.Serializable; import java.util.List; import java.util.Locale; import java.util.Map; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.DuplicateMappingException; import com.fr.third.org.hibernate.HibernateException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/MetadataBuildingOptions.java b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/MetadataBuildingOptions.java index 2c24a2199..292479586 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/MetadataBuildingOptions.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/boot/spi/MetadataBuildingOptions.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.boot.spi; import java.util.List; import java.util.Map; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.SharedCacheMode; import com.fr.third.org.hibernate.MultiTenancyStrategy; import com.fr.third.org.hibernate.annotations.common.reflection.ReflectionManager; @@ -107,7 +107,7 @@ public interface MetadataBuildingOptions { /** * Access the temporary ClassLoader passed to us as defined by - * {@link javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}, if any. + * {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}, if any. * * @return The tempo ClassLoader */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java index a26e2db88..60c0aecc3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java @@ -8,8 +8,8 @@ package com.fr.third.org.hibernate.bytecode.enhance.internal; import java.util.Collection; import java.util.Locale; -import javax.persistence.EmbeddedId; -import javax.persistence.Id; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Id; import javassist.CtClass; import javassist.CtField; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/FieldWriter.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/FieldWriter.java index 64cee189e..83e17c2d6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/FieldWriter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/FieldWriter.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.bytecode.enhance.internal; -import javax.persistence.Transient; +import com.fr.third.javax.persistence.Transient; import javassist.CannotCompileException; import javassist.CtClass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesEnhancer.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesEnhancer.java index f33cd303a..287889301 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesEnhancer.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesEnhancer.java @@ -13,12 +13,12 @@ import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; -import javax.persistence.Embedded; -import javax.persistence.Id; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; +import com.fr.third.javax.persistence.Embedded; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; import javassist.CannotCompileException; import javassist.ClassPool; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesHelper.java index a0bd72a8c..918548860 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/internal/PersistentAttributesHelper.java @@ -10,12 +10,12 @@ import java.beans.Introspector; import java.lang.annotation.Annotation; import java.util.Collection; import java.util.Map; -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.AccessType; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; import javassist.CtClass; import javassist.CtField; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/DefaultEnhancementContext.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/DefaultEnhancementContext.java index f2b5a0123..7ce6ec408 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/DefaultEnhancementContext.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/DefaultEnhancementContext.java @@ -6,13 +6,13 @@ */ package com.fr.third.org.hibernate.bytecode.enhance.spi; -import javax.persistence.ElementCollection; -import javax.persistence.Embeddable; -import javax.persistence.Entity; -import javax.persistence.ManyToMany; -import javax.persistence.MappedSuperclass; -import javax.persistence.OneToMany; -import javax.persistence.Transient; +import com.fr.third.javax.persistence.ElementCollection; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.Transient; import javassist.CtClass; import javassist.CtField; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/EnhancementContext.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/EnhancementContext.java index a3c375c92..cf3c233eb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/EnhancementContext.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/enhance/spi/EnhancementContext.java @@ -28,7 +28,7 @@ public interface EnhancementContext { /** * Obtain access to the ClassLoader that can be used to load Class references. In JPA SPI terms, this * should be a "temporary class loader" as defined by - * {@link javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()} + * {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()} * * @return The class loader that the enhancer can use. */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/spi/ClassTransformer.java b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/spi/ClassTransformer.java index 4b43923b9..f46db7eda 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/spi/ClassTransformer.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/bytecode/spi/ClassTransformer.java @@ -19,7 +19,7 @@ import java.security.ProtectionDomain; * @author Bill Burke * @author Emmanuel Bernard */ -public interface ClassTransformer extends javax.persistence.spi.ClassTransformer { +public interface ClassTransformer extends com.fr.third.javax.persistence.spi.ClassTransformer { /** * Invoked when a class is being loaded or redefined to add hooks for persistence bytecode manipulation. * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cache/internal/StandardQueryCache.java b/fine-hibernate/src/com/fr/third/org/hibernate/cache/internal/StandardQueryCache.java index 0b6959fb4..b8e9321ab 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cache/internal/StandardQueryCache.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cache/internal/StandardQueryCache.java @@ -11,7 +11,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.Set; -import javax.persistence.EntityNotFoundException; +import com.fr.third.javax.persistence.EntityNotFoundException; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.UnresolvableObjectException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AbstractPropertyHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AbstractPropertyHolder.java index f6e57a2d5..cf005b0d5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AbstractPropertyHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AbstractPropertyHolder.java @@ -8,16 +8,16 @@ package com.fr.third.org.hibernate.cfg; import java.util.HashMap; import java.util.Map; -import javax.persistence.AssociationOverride; -import javax.persistence.AssociationOverrides; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.AssociationOverride; +import com.fr.third.javax.persistence.AssociationOverrides; +import com.fr.third.javax.persistence.AttributeOverride; +import com.fr.third.javax.persistence.AttributeOverrides; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.MappedSuperclass; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AccessType.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AccessType.java index 5c355fc6e..54fc72a19 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AccessType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AccessType.java @@ -72,11 +72,11 @@ public enum AccessType { * * @return The Hibernate AccessType */ - public static AccessType getAccessStrategy(javax.persistence.AccessType type) { - if ( javax.persistence.AccessType.PROPERTY.equals( type ) ) { + public static AccessType getAccessStrategy(com.fr.third.javax.persistence.AccessType type) { + if ( com.fr.third.javax.persistence.AccessType.PROPERTY.equals( type ) ) { return PROPERTY; } - else if ( javax.persistence.AccessType.FIELD.equals( type ) ) { + else if ( com.fr.third.javax.persistence.AccessType.FIELD.equals( type ) ) { return FIELD; } else { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AnnotationBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AnnotationBinder.java index b3c709239..43f6354ee 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AnnotationBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AnnotationBinder.java @@ -20,55 +20,55 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.Set; -import javax.persistence.Basic; -import javax.persistence.Cacheable; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ConstraintMode; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; -import javax.persistence.DiscriminatorValue; -import javax.persistence.ElementCollection; -import javax.persistence.Embeddable; -import javax.persistence.Embedded; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.MapKey; -import javax.persistence.MapKeyColumn; -import javax.persistence.MapKeyJoinColumn; -import javax.persistence.MapKeyJoinColumns; -import javax.persistence.MappedSuperclass; -import javax.persistence.MapsId; -import javax.persistence.NamedNativeQueries; -import javax.persistence.NamedNativeQuery; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.NamedStoredProcedureQueries; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.OrderColumn; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.PrimaryKeyJoinColumns; -import javax.persistence.SequenceGenerator; -import javax.persistence.SharedCacheMode; -import javax.persistence.SqlResultSetMapping; -import javax.persistence.SqlResultSetMappings; -import javax.persistence.Table; -import javax.persistence.TableGenerator; -import javax.persistence.UniqueConstraint; -import javax.persistence.Version; +import com.fr.third.javax.persistence.Basic; +import com.fr.third.javax.persistence.Cacheable; +import com.fr.third.javax.persistence.CollectionTable; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.ConstraintMode; +import com.fr.third.javax.persistence.DiscriminatorColumn; +import com.fr.third.javax.persistence.DiscriminatorType; +import com.fr.third.javax.persistence.DiscriminatorValue; +import com.fr.third.javax.persistence.ElementCollection; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Embedded; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.FetchType; +import com.fr.third.javax.persistence.GeneratedValue; +import com.fr.third.javax.persistence.GenerationType; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.IdClass; +import com.fr.third.javax.persistence.InheritanceType; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinColumns; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.MapKey; +import com.fr.third.javax.persistence.MapKeyColumn; +import com.fr.third.javax.persistence.MapKeyJoinColumn; +import com.fr.third.javax.persistence.MapKeyJoinColumns; +import com.fr.third.javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.MapsId; +import com.fr.third.javax.persistence.NamedNativeQueries; +import com.fr.third.javax.persistence.NamedNativeQuery; +import com.fr.third.javax.persistence.NamedQueries; +import com.fr.third.javax.persistence.NamedQuery; +import com.fr.third.javax.persistence.NamedStoredProcedureQueries; +import com.fr.third.javax.persistence.NamedStoredProcedureQuery; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; +import com.fr.third.javax.persistence.OrderColumn; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumn; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumns; +import com.fr.third.javax.persistence.SequenceGenerator; +import com.fr.third.javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.SqlResultSetMapping; +import com.fr.third.javax.persistence.SqlResultSetMappings; +import com.fr.third.javax.persistence.Table; +import com.fr.third.javax.persistence.TableGenerator; +import com.fr.third.javax.persistence.UniqueConstraint; +import com.fr.third.javax.persistence.Version; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; @@ -542,9 +542,9 @@ public final class AnnotationBinder { String table = ""; //might be no @Table annotation on the annotated class String catalog = ""; List uniqueConstraints = new ArrayList(); - javax.persistence.Table tabAnn = null; - if ( clazzToProcess.isAnnotationPresent( javax.persistence.Table.class ) ) { - tabAnn = clazzToProcess.getAnnotation( javax.persistence.Table.class ); + com.fr.third.javax.persistence.Table tabAnn = null; + if ( clazzToProcess.isAnnotationPresent( com.fr.third.javax.persistence.Table.class ) ) { + tabAnn = clazzToProcess.getAnnotation( com.fr.third.javax.persistence.Table.class ); table = tabAnn.name(); schema = tabAnn.schema(); catalog = tabAnn.catalog(); @@ -630,11 +630,11 @@ public final class AnnotationBinder { inheritanceStatePerClass ); - javax.persistence.SecondaryTable secTabAnn = clazzToProcess.getAnnotation( - javax.persistence.SecondaryTable.class + com.fr.third.javax.persistence.SecondaryTable secTabAnn = clazzToProcess.getAnnotation( + com.fr.third.javax.persistence.SecondaryTable.class ); - javax.persistence.SecondaryTables secTabsAnn = clazzToProcess.getAnnotation( - javax.persistence.SecondaryTables.class + com.fr.third.javax.persistence.SecondaryTables secTabsAnn = clazzToProcess.getAnnotation( + com.fr.third.javax.persistence.SecondaryTables.class ); entityBinder.firstLevelSecondaryTablesBinding( secTabAnn, secTabsAnn ); @@ -785,8 +785,8 @@ public final class AnnotationBinder { final boolean isRoot = !inheritanceState.hasParents(); Ejb3DiscriminatorColumn discriminatorColumn = null; - javax.persistence.DiscriminatorColumn discAnn = clazzToProcess.getAnnotation( - javax.persistence.DiscriminatorColumn.class + com.fr.third.javax.persistence.DiscriminatorColumn discAnn = clazzToProcess.getAnnotation( + com.fr.third.javax.persistence.DiscriminatorColumn.class ); DiscriminatorType discriminatorType = discAnn != null ? discAnn.discriminatorType() @@ -1287,7 +1287,7 @@ public final class AnnotationBinder { if ( !classType.equals( AnnotatedClassType.ENTITY ) ) { throw new AnnotationException( - "Annotated class should have a @javax.persistence.Entity, @javax.persistence.Embeddable or @javax.persistence.EmbeddedSuperclass annotation: " + clazzToProcess + "Annotated class should have a @com.fr.third.javax.persistence.Entity, @com.fr.third.javax.persistence.Embeddable or @com.fr.third.javax.persistence.EmbeddedSuperclass annotation: " + clazzToProcess .getName() ); } @@ -1904,7 +1904,7 @@ public final class AnnotationBinder { collectionBinder.setBatchSize( property.getAnnotation( BatchSize.class ) ); - collectionBinder.setJpaOrderBy( property.getAnnotation( javax.persistence.OrderBy.class ) ); + collectionBinder.setJpaOrderBy( property.getAnnotation( com.fr.third.javax.persistence.OrderBy.class ) ); collectionBinder.setSqlOrderBy( property.getAnnotation( OrderBy.class ) ); collectionBinder.setSort( property.getAnnotation( Sort.class ) ); @@ -2387,7 +2387,7 @@ public final class AnnotationBinder { final UniqueConstraint[] uniqueConstraints; final JoinColumn[] joins; final JoinColumn[] inverseJoins; - final javax.persistence.Index[] jpaIndexes; + final com.fr.third.javax.persistence.Index[] jpaIndexes; //JPA 2 has priority @@ -3178,10 +3178,10 @@ public final class AnnotationBinder { ); } - private static EnumSet convertToHibernateCascadeType(javax.persistence.CascadeType[] ejbCascades) { + private static EnumSet convertToHibernateCascadeType(com.fr.third.javax.persistence.CascadeType[] ejbCascades) { EnumSet hibernateCascadeSet = EnumSet.noneOf( CascadeType.class ); if ( ejbCascades != null && ejbCascades.length > 0 ) { - for ( javax.persistence.CascadeType cascade : ejbCascades ) { + for ( com.fr.third.javax.persistence.CascadeType cascade : ejbCascades ) { switch ( cascade ) { case ALL: hibernateCascadeSet.add( CascadeType.ALL ); @@ -3209,7 +3209,7 @@ public final class AnnotationBinder { } private static String getCascadeStrategy( - javax.persistence.CascadeType[] ejbCascades, + com.fr.third.javax.persistence.CascadeType[] ejbCascades, Cascade hibernateCascadeAnnotation, boolean orphanRemoval, boolean forcePersist) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConversionInfo.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConversionInfo.java index 31ff7a81a..18d6461da 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConversionInfo.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConversionInfo.java @@ -6,13 +6,13 @@ */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.AttributeConverter; -import javax.persistence.Convert; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.Convert; import com.fr.third.org.hibernate.annotations.common.reflection.XAnnotatedElement; /** - * Describes a {@link javax.persistence.Convert} conversion + * Describes a {@link com.fr.third.javax.persistence.Convert} conversion * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConverterDefinition.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConverterDefinition.java index b9c3a3cc4..a0964ebd4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConverterDefinition.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AttributeConverterDefinition.java @@ -12,8 +12,8 @@ import java.lang.reflect.TypeVariable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.Converter; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AvailableSettings.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AvailableSettings.java index 3fbf9c5aa..3d46e60f0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AvailableSettings.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/AvailableSettings.java @@ -248,7 +248,7 @@ public interface AvailableSettings { /** * Setting used to give the name of the default {@link com.fr.third.org.hibernate.annotations.CacheConcurrencyStrategy} - * to use when either {@link javax.persistence.Cacheable @Cacheable} or + * to use when either {@link com.fr.third.javax.persistence.Cacheable @Cacheable} or * {@link com.fr.third.org.hibernate.annotations.Cache @Cache} is used. {@link com.fr.third.org.hibernate.annotations.Cache @Cache(strategy="..")} is used to override. * * @see MetadataBuilder#applyAccessType(com.fr.third.org.hibernate.cache.spi.access.AccessType) @@ -775,8 +775,8 @@ public interface AvailableSettings { /** * Assuming {@link #GLOBALLY_QUOTED_IDENTIFIERS}, this allows such global quoting - * to skip column-definitions as defined by {@link javax.persistence.Column}, - * {@link javax.persistence.JoinColumn}, etc. + * to skip column-definitions as defined by {@link com.fr.third.javax.persistence.Column}, + * {@link com.fr.third.javax.persistence.JoinColumn}, etc. *

    * JPA states that column-definitions are subject to global quoting, so by default this setting * is {@code false} for JPA compliance. Set to {@code true} to avoid column-definitions @@ -879,7 +879,7 @@ public interface AvailableSettings { * * @see com.fr.third.org.hibernate.tool.schema.Action */ - String HBM2DDL_DATABASE_ACTION = "javax.persistence.schema-generation.database.action"; + String HBM2DDL_DATABASE_ACTION = "com.fr.third.javax.persistence.schema-generation.database.action"; /** * Setting to perform SchemaManagementTool actions writing the commands into a DDL script file. @@ -890,7 +890,7 @@ public interface AvailableSettings { * * @see com.fr.third.org.hibernate.tool.schema.Action */ - String HBM2DDL_SCRIPTS_ACTION = "javax.persistence.schema-generation.scripts.action"; + String HBM2DDL_SCRIPTS_ACTION = "com.fr.third.javax.persistence.schema-generation.scripts.action"; /** * Allows passing a specific {@link java.sql.Connection} instance to be used by SchemaManagementTool. @@ -898,7 +898,7 @@ public interface AvailableSettings { * May also be used to determine the values for {@value #HBM2DDL_DB_NAME}, * {@value #HBM2DDL_DB_MAJOR_VERSION} and {@value #HBM2DDL_DB_MINOR_VERSION}. */ - String HBM2DDL_CONNECTION = "javax.persistence.schema-generation-connection"; + String HBM2DDL_CONNECTION = "com.fr.third.javax.persistence.schema-generation-connection"; /** * Specifies the name of the database provider in cases where a Connection to the underlying database is @@ -915,7 +915,7 @@ public interface AvailableSettings { * @see #HBM2DDL_DB_MINOR_VERSION */ @SuppressWarnings("JavaDoc") - String HBM2DDL_DB_NAME = "javax.persistence.database-product-name"; + String HBM2DDL_DB_NAME = "com.fr.third.javax.persistence.database-product-name"; /** * Specifies the major version of the underlying database, as would be returned by @@ -926,7 +926,7 @@ public interface AvailableSettings { * @see #HBM2DDL_DB_NAME * @see #HBM2DDL_DB_MINOR_VERSION */ - String HBM2DDL_DB_MAJOR_VERSION = "javax.persistence.database-major-version"; + String HBM2DDL_DB_MAJOR_VERSION = "com.fr.third.javax.persistence.database-major-version"; /** * Specifies the minor version of the underlying database, as would be returned by @@ -938,7 +938,7 @@ public interface AvailableSettings { * @see #HBM2DDL_DB_NAME * @see #HBM2DDL_DB_MAJOR_VERSION */ - String HBM2DDL_DB_MINOR_VERSION = "javax.persistence.database-minor-version"; + String HBM2DDL_DB_MINOR_VERSION = "com.fr.third.javax.persistence.database-minor-version"; /** * Specifies whether schema generation commands for schema creation are to be determine based on object/relational @@ -954,7 +954,7 @@ public interface AvailableSettings { * * @see SourceType */ - String HBM2DDL_CREATE_SOURCE = "javax.persistence.schema-generation.create-source"; + String HBM2DDL_CREATE_SOURCE = "com.fr.third.javax.persistence.schema-generation.create-source"; /** * Specifies whether schema generation commands for schema dropping are to be determine based on object/relational @@ -970,7 +970,7 @@ public interface AvailableSettings { * * @see SourceType */ - String HBM2DDL_DROP_SOURCE = "javax.persistence.schema-generation.drop-source"; + String HBM2DDL_DROP_SOURCE = "com.fr.third.javax.persistence.schema-generation.drop-source"; /** * Specifies the CREATE script file as either a {@link java.io.Reader} configured for reading of the DDL script @@ -982,7 +982,7 @@ public interface AvailableSettings { * @see #HBM2DDL_CREATE_SOURCE * @see #HBM2DDL_IMPORT_FILES */ - String HBM2DDL_CREATE_SCRIPT_SOURCE = "javax.persistence.schema-generation.create-script-source"; + String HBM2DDL_CREATE_SCRIPT_SOURCE = "com.fr.third.javax.persistence.schema-generation.create-script-source"; /** * Specifies the DROP script file as either a {@link java.io.Reader} configured for reading of the DDL script @@ -990,7 +990,7 @@ public interface AvailableSettings { * * @see #HBM2DDL_DROP_SOURCE */ - String HBM2DDL_DROP_SCRIPT_SOURCE = "javax.persistence.schema-generation.drop-script-source"; + String HBM2DDL_DROP_SCRIPT_SOURCE = "com.fr.third.javax.persistence.schema-generation.drop-script-source"; /** * For cases where the {@value #HBM2DDL_SCRIPTS_ACTION} value indicates that schema creation commands should @@ -1001,7 +1001,7 @@ public interface AvailableSettings { * @see #HBM2DDL_SCRIPTS_ACTION */ @SuppressWarnings("JavaDoc") - String HBM2DDL_SCRIPTS_CREATE_TARGET = "javax.persistence.schema-generation.scripts.create-target"; + String HBM2DDL_SCRIPTS_CREATE_TARGET = "com.fr.third.javax.persistence.schema-generation.scripts.create-target"; /** * For cases where the {@value #HBM2DDL_SCRIPTS_ACTION} value indicates that schema drop commands should @@ -1012,7 +1012,7 @@ public interface AvailableSettings { * @see #HBM2DDL_SCRIPTS_ACTION */ @SuppressWarnings("JavaDoc") - String HBM2DDL_SCRIPTS_DROP_TARGET = "javax.persistence.schema-generation.scripts.drop-target"; + String HBM2DDL_SCRIPTS_DROP_TARGET = "com.fr.third.javax.persistence.schema-generation.scripts.drop-target"; /** * Comma-separated names of the optional files containing SQL DML statements executed @@ -1038,7 +1038,7 @@ public interface AvailableSettings { *

    * A "SQL load script" is a script that performs some database initialization (INSERT, etc). */ - String HBM2DDL_LOAD_SCRIPT_SOURCE = "javax.persistence.sql-load-script-source"; + String HBM2DDL_LOAD_SCRIPT_SOURCE = "com.fr.third.javax.persistence.sql-load-script-source"; /** * Reference to the {@link com.fr.third.org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor} implementation class @@ -1070,7 +1070,7 @@ public interface AvailableSettings { * contains "CREATE SCHEMA" commands. If this property is not supplied (or is explicitly {@code false}), the * provider should not attempt to create database schemas. */ - String HBM2DLL_CREATE_SCHEMAS = "javax.persistence.create-database-schemas"; + String HBM2DLL_CREATE_SCHEMAS = "com.fr.third.javax.persistence.create-database-schemas"; /** * Used to specify the {@link com.fr.third.org.hibernate.tool.schema.spi.SchemaFilterProvider} to be used by diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/BinderHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/BinderHelper.java index e71dfaf0f..ed20c9612 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/BinderHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/BinderHelper.java @@ -711,7 +711,7 @@ public class BinderHelper { public static Any buildAnyValue( String anyMetaDefName, Ejb3JoinColumn[] columns, - javax.persistence.Column metaColumn, + com.fr.third.javax.persistence.Column metaColumn, PropertyData inferredData, boolean cascadeOnDelete, Nullability nullability, @@ -768,7 +768,7 @@ public class BinderHelper { } Ejb3Column[] metaColumns = Ejb3Column.buildColumnFromAnnotation( - new javax.persistence.Column[] { metaColumn }, + new com.fr.third.javax.persistence.Column[] { metaColumn }, null, nullability, propertyHolder, diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ClassPropertyHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ClassPropertyHolder.java index c5cb956e3..a79d0a883 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ClassPropertyHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ClassPropertyHolder.java @@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.cfg; import java.util.HashMap; import java.util.Map; -import javax.persistence.Convert; -import javax.persistence.Converts; -import javax.persistence.JoinTable; +import com.fr.third.javax.persistence.Convert; +import com.fr.third.javax.persistence.Converts; +import com.fr.third.javax.persistence.JoinTable; import com.fr.third.org.hibernate.annotations.common.AssertionFailure; import com.fr.third.org.hibernate.annotations.common.reflection.XClass; @@ -88,9 +88,9 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { // collect superclass info first collectAttributeConversionInfo( infoMap, xClass.getSuperclass() ); - final boolean canContainConvert = xClass.isAnnotationPresent( javax.persistence.Entity.class ) - || xClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) - || xClass.isAnnotationPresent( javax.persistence.Embeddable.class ); + final boolean canContainConvert = xClass.isAnnotationPresent( com.fr.third.javax.persistence.Entity.class ) + || xClass.isAnnotationPresent( com.fr.third.javax.persistence.MappedSuperclass.class ) + || xClass.isAnnotationPresent( com.fr.third.javax.persistence.Embeddable.class ); if ( ! canContainConvert ) { return; } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/CollectionPropertyHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/CollectionPropertyHolder.java index 25900a3a5..82e964293 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/CollectionPropertyHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/CollectionPropertyHolder.java @@ -9,16 +9,16 @@ package com.fr.third.org.hibernate.cfg; import java.util.HashMap; import java.util.Locale; import java.util.Map; -import javax.persistence.Convert; -import javax.persistence.Converts; -import javax.persistence.Enumerated; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.MapKeyClass; -import javax.persistence.MapKeyEnumerated; -import javax.persistence.MapKeyTemporal; -import javax.persistence.OneToMany; -import javax.persistence.Temporal; +import com.fr.third.javax.persistence.Convert; +import com.fr.third.javax.persistence.Converts; +import com.fr.third.javax.persistence.Enumerated; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.MapKeyClass; +import com.fr.third.javax.persistence.MapKeyEnumerated; +import com.fr.third.javax.persistence.MapKeyTemporal; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.Temporal; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.annotations.CollectionType; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ColumnsBuilder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ColumnsBuilder.java index f33886153..fd4eb322a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ColumnsBuilder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ColumnsBuilder.java @@ -5,15 +5,15 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.ElementCollection; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinColumns; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.annotations.Columns; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ComponentPropertyHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ComponentPropertyHolder.java index 210417a51..977f4e376 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ComponentPropertyHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ComponentPropertyHolder.java @@ -8,13 +8,13 @@ package com.fr.third.org.hibernate.cfg; import java.util.HashMap; import java.util.Map; -import javax.persistence.Column; -import javax.persistence.Convert; -import javax.persistence.Converts; -import javax.persistence.EmbeddedId; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Convert; +import com.fr.third.javax.persistence.Converts; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinTable; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.annotations.common.reflection.XClass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Configuration.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Configuration.java index e8fb5ec4d..77c2aa2d0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Configuration.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Configuration.java @@ -46,8 +46,8 @@ import com.fr.third.org.hibernate.type.SerializationException; import com.fr.third.org.hibernate.usertype.CompositeUserType; import com.fr.third.org.hibernate.usertype.UserType; -import javax.persistence.AttributeConverter; -import javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.SharedCacheMode; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; @@ -800,7 +800,7 @@ public class Configuration { /** * Sets the SharedCacheMode to use. * - * Note that at the moment, only {@link javax.persistence.SharedCacheMode#ALL} has + * Note that at the moment, only {@link com.fr.third.javax.persistence.SharedCacheMode#ALL} has * any effect in terms of {@code hbm.xml} binding. * * @param sharedCacheMode The SharedCacheMode to use diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3Column.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3Column.java index 01ccabd99..256b19177 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3Column.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3Column.java @@ -469,7 +469,7 @@ public class Ejb3Column { } public static Ejb3Column[] buildColumnFromAnnotation( - javax.persistence.Column[] anns, + com.fr.third.javax.persistence.Column[] anns, com.fr.third.org.hibernate.annotations.Formula formulaAnn, Nullability nullability, PropertyHolder propertyHolder, @@ -488,7 +488,7 @@ public class Ejb3Column { ); } public static Ejb3Column[] buildColumnFromAnnotation( - javax.persistence.Column[] anns, + com.fr.third.javax.persistence.Column[] anns, com.fr.third.org.hibernate.annotations.Formula formulaAnn, Nullability nullability, PropertyHolder propertyHolder, @@ -507,8 +507,8 @@ public class Ejb3Column { columns = new Ejb3Column[] { formulaColumn }; } else { - javax.persistence.Column[] actualCols = anns; - javax.persistence.Column[] overriddenCols = propertyHolder.getOverriddenColumn( + com.fr.third.javax.persistence.Column[] actualCols = anns; + com.fr.third.javax.persistence.Column[] overriddenCols = propertyHolder.getOverriddenColumn( StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) ); if ( overriddenCols != null ) { @@ -539,7 +539,7 @@ public class Ejb3Column { final ImplicitNamingStrategy implicitNamingStrategy = context.getBuildingOptions().getImplicitNamingStrategy(); final PhysicalNamingStrategy physicalNamingStrategy = context.getBuildingOptions().getPhysicalNamingStrategy(); - javax.persistence.Column col = actualCols[index]; + com.fr.third.javax.persistence.Column col = actualCols[index]; final String sqlType; if ( col.columnDefinition().equals( "" ) ) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3DiscriminatorColumn.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3DiscriminatorColumn.java index dbf5bfcfb..1dc07e654 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3DiscriminatorColumn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3DiscriminatorColumn.java @@ -5,8 +5,8 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; +import com.fr.third.javax.persistence.DiscriminatorColumn; +import com.fr.third.javax.persistence.DiscriminatorType; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.annotations.DiscriminatorFormula; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3JoinColumn.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3JoinColumn.java index a4f69ab81..0653bc950 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3JoinColumn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/Ejb3JoinColumn.java @@ -11,8 +11,8 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.persistence.JoinColumn; -import javax.persistence.PrimaryKeyJoinColumn; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumn; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/IndexColumn.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/IndexColumn.java index b1f2fef94..0acd1704f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/IndexColumn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/IndexColumn.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.cfg; import java.util.Map; -import javax.persistence.OrderColumn; +import com.fr.third.javax.persistence.OrderColumn; import com.fr.third.org.hibernate.boot.spi.MetadataBuildingContext; import com.fr.third.org.hibernate.mapping.Join; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/InheritanceState.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/InheritanceState.java index 6e57e3701..04674ddba 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/InheritanceState.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/InheritanceState.java @@ -8,14 +8,14 @@ package com.fr.third.org.hibernate.cfg; import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.persistence.Access; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.IdClass; +import com.fr.third.javax.persistence.Inheritance; +import com.fr.third.javax.persistence.InheritanceType; +import com.fr.third.javax.persistence.MappedSuperclass; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.annotations.common.reflection.XAnnotatedElement; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/JPAIndexHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/JPAIndexHolder.java index f763ae524..04c0f161e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/JPAIndexHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/JPAIndexHolder.java @@ -10,7 +10,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.StringTokenizer; -import javax.persistence.Index; +import com.fr.third.javax.persistence.Index; /** * @author Strong Liu diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/OneToOneSecondPass.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/OneToOneSecondPass.java index 8b6fd9837..9252859ae 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/OneToOneSecondPass.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/OneToOneSecondPass.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.cfg; import java.util.Iterator; import java.util.Map; -import javax.persistence.ConstraintMode; +import com.fr.third.javax.persistence.ConstraintMode; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.MappingException; @@ -251,7 +251,7 @@ public class OneToOneSecondPass implements SecondPass { value.setForeignKeyName( fk.name() ); } else { - final javax.persistence.ForeignKey jpaFk = inferredData.getProperty().getAnnotation( javax.persistence.ForeignKey.class ); + final com.fr.third.javax.persistence.ForeignKey jpaFk = inferredData.getProperty().getAnnotation( com.fr.third.javax.persistence.ForeignKey.class ); if ( jpaFk != null ) { if ( jpaFk.value() == ConstraintMode.NO_CONSTRAINT ) { value.setForeignKeyName( "none" ); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyContainer.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyContainer.java index af3ad3c43..7c54635e1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyContainer.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyContainer.java @@ -16,12 +16,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TreeMap; -import javax.persistence.Access; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Transient; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; +import com.fr.third.javax.persistence.Transient; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.MappingException; @@ -136,7 +136,7 @@ class PropertyContainer { final XProperty xProperty = propertyIterator.next(); final Access localAccessAnnotation = xProperty.getAnnotation( Access.class ); if ( localAccessAnnotation == null - || localAccessAnnotation.value() != javax.persistence.AccessType.FIELD ) { + || localAccessAnnotation.value() != com.fr.third.javax.persistence.AccessType.FIELD ) { continue; } @@ -150,7 +150,7 @@ class PropertyContainer { final XProperty xProperty = propertyIterator.next(); final Access localAccessAnnotation = xProperty.getAnnotation( Access.class ); if ( localAccessAnnotation == null - || localAccessAnnotation.value() != javax.persistence.AccessType.PROPERTY ) { + || localAccessAnnotation.value() != com.fr.third.javax.persistence.AccessType.PROPERTY ) { continue; } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyHolder.java index 8794404f9..49316c5e2 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyHolder.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.Column; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinTable; import com.fr.third.org.hibernate.annotations.common.reflection.XClass; import com.fr.third.org.hibernate.annotations.common.reflection.XProperty; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyInferredData.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyInferredData.java index ca1471832..422a56155 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyInferredData.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/PropertyInferredData.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.Access; +import com.fr.third.javax.persistence.Access; import com.fr.third.org.hibernate.MappingException; import com.fr.third.org.hibernate.annotations.Target; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ToOneBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ToOneBinder.java index e88737f23..d55cf4f56 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ToOneBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/ToOneBinder.java @@ -5,8 +5,8 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.cfg; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.OneToOne; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.annotations.common.reflection.XClass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/UniqueConstraintHolder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/UniqueConstraintHolder.java index 0cb3e9c3a..f19c8c82e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/UniqueConstraintHolder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/UniqueConstraintHolder.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.cfg; /** - * {@link javax.persistence.UniqueConstraint} annotations are handled via second pass. I do not + * {@link com.fr.third.javax.persistence.UniqueConstraint} annotations are handled via second pass. I do not * understand the reasons why at this time, so here I use a holder object to hold the information * needed to create the unique constraint. The ability to name it is new, and so the code used to * simply keep this as a String array (the column names). diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CollectionBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CollectionBinder.java index fd6ecbf0a..b3ee6cd65 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CollectionBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CollectionBinder.java @@ -13,20 +13,20 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.CollectionTable; -import javax.persistence.ConstraintMode; -import javax.persistence.ElementCollection; -import javax.persistence.Embeddable; -import javax.persistence.FetchType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.MapKey; -import javax.persistence.MapKeyColumn; -import javax.persistence.OneToMany; +import com.fr.third.javax.persistence.AttributeOverride; +import com.fr.third.javax.persistence.AttributeOverrides; +import com.fr.third.javax.persistence.CollectionTable; +import com.fr.third.javax.persistence.ConstraintMode; +import com.fr.third.javax.persistence.ElementCollection; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.FetchType; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinColumns; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.MapKey; +import com.fr.third.javax.persistence.MapKeyColumn; +import com.fr.third.javax.persistence.OneToMany; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.FetchMode; @@ -150,7 +150,7 @@ public abstract class CollectionBinder { private boolean hibernateExtensionMapping; private boolean isSortedCollection; - private javax.persistence.OrderBy jpaOrderBy; + private com.fr.third.javax.persistence.OrderBy jpaOrderBy; private OrderBy sqlOrderBy; private Sort deprecatedSort; private SortNatural naturalSort; @@ -217,7 +217,7 @@ public abstract class CollectionBinder { this.batchSize = batchSize == null ? -1 : batchSize.size(); } - public void setJpaOrderBy(javax.persistence.OrderBy jpaOrderBy) { + public void setJpaOrderBy(com.fr.third.javax.persistence.OrderBy jpaOrderBy) { this.jpaOrderBy = jpaOrderBy; } @@ -391,7 +391,7 @@ public abstract class CollectionBinder { if ( property.isAnnotationPresent( MapKeyColumn.class ) && mapKeyPropertyName != null ) { throw new AnnotationException( - "Cannot mix @javax.persistence.MapKey and @MapKeyColumn or @com.fr.third.org.hibernate.annotations.MapKey " + "Cannot mix @com.fr.third.javax.persistence.MapKey and @MapKeyColumn or @com.fr.third.org.hibernate.annotations.MapKey " + "on the same collection: " + StringHelper.qualify( propertyHolder.getPath(), propertyName ) @@ -579,7 +579,7 @@ public abstract class CollectionBinder { throw new AnnotationException( String.format( "Illegal combination of @%s and @%s on %s", - javax.persistence.OrderBy.class.getName(), + com.fr.third.javax.persistence.OrderBy.class.getName(), OrderBy.class.getName(), safeCollectionRole() ) @@ -1527,7 +1527,7 @@ public abstract class CollectionBinder { } - private String extractHqlOrderBy(javax.persistence.OrderBy jpaOrderBy) { + private String extractHqlOrderBy(com.fr.third.javax.persistence.OrderBy jpaOrderBy) { if ( jpaOrderBy != null ) { return jpaOrderBy.value(); // Null not possible. In case of empty expression, apply default ordering. } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CustomizableColumns.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CustomizableColumns.java index 671b037ba..8874c0591 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CustomizableColumns.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/CustomizableColumns.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.cfg.annotations; import java.lang.annotation.Annotation; -import javax.persistence.Column; +import com.fr.third.javax.persistence.Column; import com.fr.third.org.hibernate.annotations.Columns; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/EntityBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/EntityBinder.java index d6bc3638f..cb87a9fa3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/EntityBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/EntityBinder.java @@ -11,16 +11,16 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; -import javax.persistence.Access; -import javax.persistence.ConstraintMode; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.NamedEntityGraph; -import javax.persistence.NamedEntityGraphs; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.SecondaryTable; -import javax.persistence.SecondaryTables; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.ConstraintMode; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.NamedEntityGraph; +import com.fr.third.javax.persistence.NamedEntityGraphs; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumn; +import com.fr.third.javax.persistence.SecondaryTable; +import com.fr.third.javax.persistence.SecondaryTables; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; @@ -800,7 +800,7 @@ public class EntityBinder { ( (SimpleValue) join.getKey() ).setForeignKeyName( matchingTable.foreignKey().name() ); } else { - javax.persistence.SecondaryTable jpaSecondaryTable = findMatchingSecondaryTable( join ); + com.fr.third.javax.persistence.SecondaryTable jpaSecondaryTable = findMatchingSecondaryTable( join ); if ( jpaSecondaryTable != null ) { if ( jpaSecondaryTable.foreignKey().value() == ConstraintMode.NO_CONSTRAINT ) { ( (SimpleValue) join.getKey() ).setForeignKeyName( "none" ); @@ -1101,7 +1101,7 @@ public class EntityBinder { public void setIgnoreIdAnnotations(boolean ignoreIdAnnotations) { this.ignoreIdAnnotations = ignoreIdAnnotations; } - public void processComplementaryTableDefinitions(javax.persistence.Table table) { + public void processComplementaryTableDefinitions(com.fr.third.javax.persistence.Table table) { if ( table == null ) return; TableBinder.addIndexes( persistentClass.getTable(), table.indexes(), context ); } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapBinder.java index af835f746..db028481e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapBinder.java @@ -10,9 +10,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Random; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.MapKeyClass; +import com.fr.third.javax.persistence.AttributeOverride; +import com.fr.third.javax.persistence.AttributeOverrides; +import com.fr.third.javax.persistence.MapKeyClass; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyColumnDelegator.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyColumnDelegator.java index 48b85378f..1735fc45f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyColumnDelegator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyColumnDelegator.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.cfg.annotations; import java.lang.annotation.Annotation; -import javax.persistence.Column; -import javax.persistence.MapKeyColumn; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.MapKeyColumn; /** * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyJoinColumnDelegator.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyJoinColumnDelegator.java index 285c2b944..b93993225 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyJoinColumnDelegator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/MapKeyJoinColumnDelegator.java @@ -7,10 +7,10 @@ package com.fr.third.org.hibernate.cfg.annotations; import java.lang.annotation.Annotation; -import javax.persistence.Column; -import javax.persistence.ForeignKey; -import javax.persistence.JoinColumn; -import javax.persistence.MapKeyJoinColumn; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.ForeignKey; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.MapKeyJoinColumn; /** * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedEntityGraphDefinition.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedEntityGraphDefinition.java index 7d3dc9b8d..0e357aba9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedEntityGraphDefinition.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedEntityGraphDefinition.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.cfg.annotations; -import javax.persistence.NamedEntityGraph; +import com.fr.third.javax.persistence.NamedEntityGraph; import com.fr.third.org.hibernate.internal.util.StringHelper; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedProcedureCallDefinition.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedProcedureCallDefinition.java index 6e1665f44..03bf40411 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedProcedureCallDefinition.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/NamedProcedureCallDefinition.java @@ -12,9 +12,9 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.ParameterMode; -import javax.persistence.StoredProcedureParameter; +import com.fr.third.javax.persistence.NamedStoredProcedureQuery; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.StoredProcedureParameter; import com.fr.third.org.hibernate.MappingException; import com.fr.third.org.hibernate.cfg.AvailableSettings; @@ -36,7 +36,7 @@ import static com.fr.third.org.hibernate.procedure.internal.ProcedureCallMemento * * @author Steve Ebersole * - * @see javax.persistence.NamedStoredProcedureQuery + * @see com.fr.third.javax.persistence.NamedStoredProcedureQuery */ public class NamedProcedureCallDefinition { private final String registeredName; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/PropertyBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/PropertyBinder.java index ccbd33645..f1f0e9ae1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/PropertyBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/PropertyBinder.java @@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.cfg.annotations; import java.lang.annotation.Annotation; import java.util.Map; -import javax.persistence.EmbeddedId; -import javax.persistence.Id; -import javax.persistence.Lob; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.Lob; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.HibernateException; @@ -304,7 +304,7 @@ public class PropertyBinder { if ( lockAnn != null ) { //TODO this should go to the core as a mapping validation checking if ( lockAnn.excluded() && ( - property.isAnnotationPresent( javax.persistence.Version.class ) + property.isAnnotationPresent( com.fr.third.javax.persistence.Version.class ) || property.isAnnotationPresent( Id.class ) || property.isAnnotationPresent( EmbeddedId.class ) ) ) { throw new AnnotationException( @@ -391,7 +391,7 @@ public class PropertyBinder { ); if ( annotation.annotationType() == Generated.class && - property.isAnnotationPresent( javax.persistence.Version.class ) && + property.isAnnotationPresent( com.fr.third.javax.persistence.Version.class ) && valueGeneration.getGenerationTiming() == GenerationTiming.INSERT ) { throw new AnnotationException( diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryBinder.java index bfa26f833..29af7c0f1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryBinder.java @@ -7,13 +7,13 @@ package com.fr.third.org.hibernate.cfg.annotations; import java.util.HashMap; -import javax.persistence.NamedNativeQueries; -import javax.persistence.NamedNativeQuery; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.SqlResultSetMapping; -import javax.persistence.SqlResultSetMappings; +import com.fr.third.javax.persistence.NamedNativeQueries; +import com.fr.third.javax.persistence.NamedNativeQuery; +import com.fr.third.javax.persistence.NamedQueries; +import com.fr.third.javax.persistence.NamedQuery; +import com.fr.third.javax.persistence.NamedStoredProcedureQuery; +import com.fr.third.javax.persistence.SqlResultSetMapping; +import com.fr.third.javax.persistence.SqlResultSetMappings; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryHintDefinition.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryHintDefinition.java index caad0c355..3a114671c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryHintDefinition.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/QueryHintDefinition.java @@ -9,9 +9,9 @@ package com.fr.third.org.hibernate.cfg.annotations; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.persistence.LockModeType; -import javax.persistence.NamedQuery; -import javax.persistence.QueryHint; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.NamedQuery; +import com.fr.third.javax.persistence.QueryHint; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.CacheMode; @@ -119,7 +119,7 @@ public class QueryHintDefinition { public LockOptions determineLockOptions(NamedQuery namedQueryAnnotation) { LockModeType lockModeType = namedQueryAnnotation.lockMode(); - Integer lockTimeoutHint = getInteger( namedQueryAnnotation.name(), "javax.persistence.lock.timeout" ); + Integer lockTimeoutHint = getInteger( namedQueryAnnotation.name(), "com.fr.third.javax.persistence.lock.timeout" ); LockOptions lockOptions = new LockOptions( LockModeConverter.convertToLockMode( lockModeType ) ); if ( lockTimeoutHint != null ) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java index cafc240e2..afe72b04f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java @@ -14,11 +14,11 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.persistence.ColumnResult; -import javax.persistence.ConstructorResult; -import javax.persistence.EntityResult; -import javax.persistence.FieldResult; -import javax.persistence.SqlResultSetMapping; +import com.fr.third.javax.persistence.ColumnResult; +import com.fr.third.javax.persistence.ConstructorResult; +import com.fr.third.javax.persistence.EntityResult; +import com.fr.third.javax.persistence.FieldResult; +import com.fr.third.javax.persistence.SqlResultSetMapping; import com.fr.third.org.hibernate.LockMode; import com.fr.third.org.hibernate.MappingException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java index 88762c650..c80d9f1c1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/SimpleValueBinder.java @@ -11,13 +11,13 @@ import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.Properties; -import javax.persistence.Enumerated; -import javax.persistence.Id; -import javax.persistence.Lob; -import javax.persistence.MapKeyEnumerated; -import javax.persistence.MapKeyTemporal; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.Enumerated; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.Lob; +import com.fr.third.javax.persistence.MapKeyEnumerated; +import com.fr.third.javax.persistence.MapKeyTemporal; +import com.fr.third.javax.persistence.Temporal; +import com.fr.third.javax.persistence.TemporalType; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/TableBinder.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/TableBinder.java index 5ccb85a37..e22d59356 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/TableBinder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/TableBinder.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.cfg.annotations; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.persistence.UniqueConstraint; +import com.fr.third.javax.persistence.UniqueConstraint; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.AssertionFailure; @@ -104,7 +104,7 @@ public class TableBinder { this.uniqueConstraints = TableBinder.buildUniqueConstraintHolders( uniqueConstraints ); } - public void setJpaIndex(javax.persistence.Index[] jpaIndex){ + public void setJpaIndex(com.fr.third.javax.persistence.Index[] jpaIndex){ this.jpaIndexHolders = buildJpaIndexHolder( jpaIndex ); } @@ -751,13 +751,13 @@ public class TableBinder { } } - public static void addIndexes(Table hibTable, javax.persistence.Index[] indexes, MetadataBuildingContext buildingContext) { + public static void addIndexes(Table hibTable, com.fr.third.javax.persistence.Index[] indexes, MetadataBuildingContext buildingContext) { buildingContext.getMetadataCollector().addJpaIndexHolders( hibTable, buildJpaIndexHolder( indexes ) ); } - public static List buildJpaIndexHolder(javax.persistence.Index[] indexes){ + public static List buildJpaIndexHolder(com.fr.third.javax.persistence.Index[] indexes){ List holders = new ArrayList( indexes.length ); - for(javax.persistence.Index index : indexes){ + for(com.fr.third.javax.persistence.Index index : indexes){ holders.add( new JPAIndexHolder( index ) ); } return holders; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAMetadataProvider.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAMetadataProvider.java index 9a61183cb..336d3ff79 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAMetadataProvider.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAMetadataProvider.java @@ -11,13 +11,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.EntityListeners; -import javax.persistence.NamedNativeQuery; -import javax.persistence.NamedQuery; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.SequenceGenerator; -import javax.persistence.SqlResultSetMapping; -import javax.persistence.TableGenerator; +import com.fr.third.javax.persistence.EntityListeners; +import com.fr.third.javax.persistence.NamedNativeQuery; +import com.fr.third.javax.persistence.NamedQuery; +import com.fr.third.javax.persistence.NamedStoredProcedureQuery; +import com.fr.third.javax.persistence.SequenceGenerator; +import com.fr.third.javax.persistence.SqlResultSetMapping; +import com.fr.third.javax.persistence.TableGenerator; import com.fr.third.org.hibernate.annotations.common.reflection.AnnotationReader; import com.fr.third.org.hibernate.annotations.common.reflection.MetadataProvider; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java index c4c387def..76c6c5144 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java @@ -20,98 +20,98 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.AssociationOverride; -import javax.persistence.AssociationOverrides; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Basic; -import javax.persistence.Cacheable; -import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ColumnResult; -import javax.persistence.ConstructorResult; -import javax.persistence.Convert; -import javax.persistence.Converts; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; -import javax.persistence.DiscriminatorValue; -import javax.persistence.ElementCollection; -import javax.persistence.Embeddable; -import javax.persistence.Embedded; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.EntityResult; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.ExcludeDefaultListeners; -import javax.persistence.ExcludeSuperclassListeners; -import javax.persistence.FetchType; -import javax.persistence.FieldResult; -import javax.persistence.ForeignKey; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.Index; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.JoinColumns; -import javax.persistence.JoinTable; -import javax.persistence.Lob; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.MapKey; -import javax.persistence.MapKeyClass; -import javax.persistence.MapKeyColumn; -import javax.persistence.MapKeyEnumerated; -import javax.persistence.MapKeyJoinColumn; -import javax.persistence.MapKeyJoinColumns; -import javax.persistence.MapKeyTemporal; -import javax.persistence.MappedSuperclass; -import javax.persistence.MapsId; -import javax.persistence.NamedAttributeNode; -import javax.persistence.NamedEntityGraph; -import javax.persistence.NamedEntityGraphs; -import javax.persistence.NamedNativeQueries; -import javax.persistence.NamedNativeQuery; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.NamedStoredProcedureQueries; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.NamedSubgraph; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.OrderBy; -import javax.persistence.OrderColumn; -import javax.persistence.ParameterMode; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.PrimaryKeyJoinColumns; -import javax.persistence.QueryHint; -import javax.persistence.SecondaryTable; -import javax.persistence.SecondaryTables; -import javax.persistence.SequenceGenerator; -import javax.persistence.SqlResultSetMapping; -import javax.persistence.SqlResultSetMappings; -import javax.persistence.StoredProcedureParameter; -import javax.persistence.Table; -import javax.persistence.TableGenerator; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import javax.persistence.UniqueConstraint; -import javax.persistence.Version; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.AccessType; +import com.fr.third.javax.persistence.AssociationOverride; +import com.fr.third.javax.persistence.AssociationOverrides; +import com.fr.third.javax.persistence.AttributeOverride; +import com.fr.third.javax.persistence.AttributeOverrides; +import com.fr.third.javax.persistence.Basic; +import com.fr.third.javax.persistence.Cacheable; +import com.fr.third.javax.persistence.CascadeType; +import com.fr.third.javax.persistence.CollectionTable; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.ColumnResult; +import com.fr.third.javax.persistence.ConstructorResult; +import com.fr.third.javax.persistence.Convert; +import com.fr.third.javax.persistence.Converts; +import com.fr.third.javax.persistence.DiscriminatorColumn; +import com.fr.third.javax.persistence.DiscriminatorType; +import com.fr.third.javax.persistence.DiscriminatorValue; +import com.fr.third.javax.persistence.ElementCollection; +import com.fr.third.javax.persistence.Embeddable; +import com.fr.third.javax.persistence.Embedded; +import com.fr.third.javax.persistence.EmbeddedId; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.EntityListeners; +import com.fr.third.javax.persistence.EntityResult; +import com.fr.third.javax.persistence.EnumType; +import com.fr.third.javax.persistence.Enumerated; +import com.fr.third.javax.persistence.ExcludeDefaultListeners; +import com.fr.third.javax.persistence.ExcludeSuperclassListeners; +import com.fr.third.javax.persistence.FetchType; +import com.fr.third.javax.persistence.FieldResult; +import com.fr.third.javax.persistence.ForeignKey; +import com.fr.third.javax.persistence.GeneratedValue; +import com.fr.third.javax.persistence.GenerationType; +import com.fr.third.javax.persistence.Id; +import com.fr.third.javax.persistence.IdClass; +import com.fr.third.javax.persistence.Index; +import com.fr.third.javax.persistence.Inheritance; +import com.fr.third.javax.persistence.InheritanceType; +import com.fr.third.javax.persistence.JoinColumn; +import com.fr.third.javax.persistence.JoinColumns; +import com.fr.third.javax.persistence.JoinTable; +import com.fr.third.javax.persistence.Lob; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.ManyToOne; +import com.fr.third.javax.persistence.MapKey; +import com.fr.third.javax.persistence.MapKeyClass; +import com.fr.third.javax.persistence.MapKeyColumn; +import com.fr.third.javax.persistence.MapKeyEnumerated; +import com.fr.third.javax.persistence.MapKeyJoinColumn; +import com.fr.third.javax.persistence.MapKeyJoinColumns; +import com.fr.third.javax.persistence.MapKeyTemporal; +import com.fr.third.javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.MapsId; +import com.fr.third.javax.persistence.NamedAttributeNode; +import com.fr.third.javax.persistence.NamedEntityGraph; +import com.fr.third.javax.persistence.NamedEntityGraphs; +import com.fr.third.javax.persistence.NamedNativeQueries; +import com.fr.third.javax.persistence.NamedNativeQuery; +import com.fr.third.javax.persistence.NamedQueries; +import com.fr.third.javax.persistence.NamedQuery; +import com.fr.third.javax.persistence.NamedStoredProcedureQueries; +import com.fr.third.javax.persistence.NamedStoredProcedureQuery; +import com.fr.third.javax.persistence.NamedSubgraph; +import com.fr.third.javax.persistence.OneToMany; +import com.fr.third.javax.persistence.OneToOne; +import com.fr.third.javax.persistence.OrderBy; +import com.fr.third.javax.persistence.OrderColumn; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.PostLoad; +import com.fr.third.javax.persistence.PostPersist; +import com.fr.third.javax.persistence.PostRemove; +import com.fr.third.javax.persistence.PostUpdate; +import com.fr.third.javax.persistence.PrePersist; +import com.fr.third.javax.persistence.PreRemove; +import com.fr.third.javax.persistence.PreUpdate; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumn; +import com.fr.third.javax.persistence.PrimaryKeyJoinColumns; +import com.fr.third.javax.persistence.QueryHint; +import com.fr.third.javax.persistence.SecondaryTable; +import com.fr.third.javax.persistence.SecondaryTables; +import com.fr.third.javax.persistence.SequenceGenerator; +import com.fr.third.javax.persistence.SqlResultSetMapping; +import com.fr.third.javax.persistence.SqlResultSetMappings; +import com.fr.third.javax.persistence.StoredProcedureParameter; +import com.fr.third.javax.persistence.Table; +import com.fr.third.javax.persistence.TableGenerator; +import com.fr.third.javax.persistence.Temporal; +import com.fr.third.javax.persistence.TemporalType; +import com.fr.third.javax.persistence.Transient; +import com.fr.third.javax.persistence.UniqueConstraint; +import com.fr.third.javax.persistence.Version; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.annotations.Any; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/XMLContext.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/XMLContext.java index 511f4b0a9..8aa140271 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/XMLContext.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/annotations/reflection/XMLContext.java @@ -11,8 +11,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.AccessType; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AccessType; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.AnnotationException; import com.fr.third.org.hibernate.boot.registry.classloading.spi.ClassLoadingException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/BeanValidationIntegrator.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/BeanValidationIntegrator.java index 8ab073142..d56545abf 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/BeanValidationIntegrator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/BeanValidationIntegrator.java @@ -34,7 +34,7 @@ public class BeanValidationIntegrator implements Integrator { public static final String BV_CHECK_CLASS = "javax.validation.Validation"; - public static final String MODE_PROPERTY = "javax.persistence.validation.mode"; + public static final String MODE_PROPERTY = "com.fr.third.javax.persistence.validation.mode"; private static final String ACTIVATOR_CLASS_NAME = "com.fr.third.org.hibernate.cfg.beanvalidation.TypeSafeActivator"; private static final String VALIDATE_SUPPLIED_FACTORY_METHOD_NAME = "validateSuppliedFactory"; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/GroupsPerOperation.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/GroupsPerOperation.java index 1dbc26bf3..cd7fdc454 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/GroupsPerOperation.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/GroupsPerOperation.java @@ -20,7 +20,7 @@ import com.fr.third.org.hibernate.boot.spi.ClassLoaderAccess; * @author Emmanuel Bernard */ public class GroupsPerOperation { - private static final String JPA_GROUP_PREFIX = "javax.persistence.validation.group."; + private static final String JPA_GROUP_PREFIX = "com.fr.third.javax.persistence.validation.group."; private static final String HIBERNATE_GROUP_PREFIX = "com.fr.third.org.hibernate.validator.group."; private static final Class[] DEFAULT_GROUPS = new Class[] { Default.class }; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java index 7a22fadc2..4aec6ebec 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java @@ -60,7 +60,7 @@ class TypeSafeActivator { private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TypeSafeActivator.class.getName()); - private static final String FACTORY_PROPERTY = "javax.persistence.validation.factory"; + private static final String FACTORY_PROPERTY = "com.fr.third.javax.persistence.validation.factory"; /** * Used to validate a supplied ValidatorFactory instance as being castable to ValidatorFactory. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/ejb/AbstractEntityManagerImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/ejb/AbstractEntityManagerImpl.java index 95358131f..bee1c65e8 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/ejb/AbstractEntityManagerImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/ejb/AbstractEntityManagerImpl.java @@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.ejb; import java.io.Serializable; import java.util.Map; -import javax.persistence.PersistenceContextType; -import javax.persistence.SynchronizationType; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.PersistenceContextType; +import com.fr.third.javax.persistence.SynchronizationType; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.jpa.internal.EntityManagerFactoryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/ejb/HibernatePersistence.java b/fine-hibernate/src/com/fr/third/org/hibernate/ejb/HibernatePersistence.java index 86f8e0ccc..d34195311 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/ejb/HibernatePersistence.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/ejb/HibernatePersistence.java @@ -7,10 +7,10 @@ package com.fr.third.org.hibernate.ejb; import java.util.Map; -import javax.persistence.EntityManagerFactory; -import javax.persistence.spi.PersistenceProvider; -import javax.persistence.spi.PersistenceUnitInfo; -import javax.persistence.spi.ProviderUtil; +import com.fr.third.javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.spi.PersistenceProvider; +import com.fr.third.javax.persistence.spi.PersistenceUnitInfo; +import com.fr.third.javax.persistence.spi.ProviderUtil; import com.fr.third.org.hibernate.jpa.HibernatePersistenceProvider; import com.fr.third.org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/env/spi/IdentifierHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/env/spi/IdentifierHelper.java index e6b21df87..38b548db9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/env/spi/IdentifierHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/jdbc/env/spi/IdentifierHelper.java @@ -55,8 +55,8 @@ public interface IdentifierHelper { /** * Intended only for use in handling quoting requirements for {@code column-definition} - * as defined by {@link javax.persistence.Column#columnDefinition()}, - * {@link javax.persistence.JoinColumn#columnDefinition}, etc. This method should not + * as defined by {@link com.fr.third.javax.persistence.Column#columnDefinition()}, + * {@link com.fr.third.javax.persistence.JoinColumn#columnDefinition}, etc. This method should not * be called in any other scenario. *

    * This method is needed to account for that fact that the JPA spec says that {@code column-definition} diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/EntityGraphQueryHint.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/EntityGraphQueryHint.java index f46cddfa5..04fb5a78a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/EntityGraphQueryHint.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/EntityGraphQueryHint.java @@ -12,9 +12,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.AttributeNode; -import javax.persistence.EntityGraph; -import javax.persistence.Subgraph; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.Subgraph; import com.fr.third.org.hibernate.QueryException; import com.fr.third.org.hibernate.engine.internal.JoinSequence; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/sql/NativeSQLQueryConstructorReturn.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/sql/NativeSQLQueryConstructorReturn.java index 976ca2549..d1784a384 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/sql/NativeSQLQueryConstructorReturn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/query/spi/sql/NativeSQLQueryConstructorReturn.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.engine.query.spi.sql; import java.util.List; /** - * Describes a {@link javax.persistence.ConstructorResult} + * Describes a {@link com.fr.third.javax.persistence.ConstructorResult} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/LoadQueryInfluencers.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/LoadQueryInfluencers.java index 78cc33e83..1d2ac54bd 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/LoadQueryInfluencers.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/LoadQueryInfluencers.java @@ -11,7 +11,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.EntityGraph; import com.fr.third.org.hibernate.Filter; import com.fr.third.org.hibernate.UnknownProfileException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/NamedQueryDefinition.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/NamedQueryDefinition.java index 72eeb86cd..dd8d96578 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/NamedQueryDefinition.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/NamedQueryDefinition.java @@ -87,7 +87,7 @@ public class NamedQueryDefinition implements Serializable { } /** - * This version is used to bind named queries defined via {@link javax.persistence.NamedQuery}. + * This version is used to bind named queries defined via {@link com.fr.third.javax.persistence.NamedQuery}. * * @param name The name under which to key/register the query * @param query The query string. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/SessionImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/SessionImplementor.java index deeb132c7..58f1650b9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/SessionImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/engine/spi/SessionImplementor.java @@ -82,7 +82,7 @@ public interface SessionImplementor extends Serializable, LobCreationContext, Wr * Hibernate behavior is to auto join any active JTA transaction (register {@link javax.transaction.Synchronization}). * JPA however defines an explicit join transaction operation. *

    - * See javax.persistence.EntityManager#joinTransaction + * See com.fr.third.javax.persistence.EntityManager#joinTransaction */ void disableTransactionAutoJoin(); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/AttributeNodeImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/AttributeNodeImplementor.java index 5554bf06a..cc1bfaa87 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/AttributeNodeImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/AttributeNodeImplementor.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.graph.spi; -import javax.persistence.AttributeNode; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.metamodel.Attribute; /** * @author Strong Liu diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/GraphNodeImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/GraphNodeImplementor.java index 4a0ba78b8..68a22071d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/GraphNodeImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/graph/spi/GraphNodeImplementor.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.graph.spi; import java.util.List; -import javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.AttributeNode; /** * @author Strong Liu diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/hql/internal/ast/tree/LiteralNode.java b/fine-hibernate/src/com/fr/third/org/hibernate/hql/internal/ast/tree/LiteralNode.java index ca0314d3c..65dd892ce 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/hql/internal/ast/tree/LiteralNode.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/hql/internal/ast/tree/LiteralNode.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.hql.internal.ast.tree; import java.sql.Types; import java.util.Locale; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.QueryException; import com.fr.third.org.hibernate.hql.internal.antlr.HqlSqlTokenTypes; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/id/EntityIdentifierNature.java b/fine-hibernate/src/com/fr/third/org/hibernate/id/EntityIdentifierNature.java index 39bdbb645..51204ec74 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/id/EntityIdentifierNature.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/id/EntityIdentifierNature.java @@ -36,7 +36,7 @@ public enum EntityIdentifierNature { * * NOTE : May or may not have a related "lookup identifier class" as indicated by a {@code @IdClass} annotation. * - * @see javax.persistence.IdClass + * @see com.fr.third.javax.persistence.IdClass */ NON_AGGREGATED_COMPOSITE, @@ -52,7 +52,7 @@ public enum EntityIdentifierNature { *

  • * * - * @see javax.persistence.EmbeddedId + * @see com.fr.third.javax.persistence.EmbeddedId */ AGGREGATED_COMPOSITE } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger.java index 2569065e2..1d966b33b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger.java @@ -39,10 +39,10 @@ import com.fr.third.org.hibernate.type.SerializationException; import com.fr.third.org.hibernate.type.Type; import com.fr.third.org.jboss.logging.BasicLogger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.Cause; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; import static com.fr.third.org.jboss.logging.Logger.Level.DEBUG; import static com.fr.third.org.jboss.logging.Logger.Level.ERROR; @@ -524,7 +524,7 @@ public interface CoreMessageLogger extends BasicLogger { int numberOfArguments); @LogMessage(level = WARN) - @Message(value = "Class annotated @com.fr.third.org.hibernate.annotations.Entity but not javax.persistence.Entity (most likely a user error): %s", + @Message(value = "Class annotated @com.fr.third.org.hibernate.annotations.Entity but not com.fr.third.javax.persistence.Entity (most likely a user error): %s", id = 175) void missingEntityAnnotation(String className); @@ -1630,7 +1630,7 @@ public interface CoreMessageLogger extends BasicLogger { void explicitSkipLockedLockCombo(); @LogMessage(level = INFO) - @Message(value = "'javax.persistence.validation.mode' named multiple values : %s", id = 448) + @Message(value = "'com.fr.third.javax.persistence.validation.mode' named multiple values : %s", id = 448) void multipleValidationModes(String modes); @LogMessage(level = WARN) diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger_$logger.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger_$logger.java index 523275231..42c45ab23 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger_$logger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/CoreMessageLogger_$logger.java @@ -929,7 +929,7 @@ public class CoreMessageLogger_$logger extends DelegatingBasicLogger implements public final void missingEntityAnnotation(final String className) { super.log.logf(FQCN, Logger.Level.WARN, null, missingEntityAnnotation$str(), className); } - private static final String missingEntityAnnotation = "HHH000175: Class annotated @com.fr.third.org.hibernate.annotations.Entity but not javax.persistence.Entity (most likely a user error): %s"; + private static final String missingEntityAnnotation = "HHH000175: Class annotated @com.fr.third.org.hibernate.annotations.Entity but not com.fr.third.javax.persistence.Entity (most likely a user error): %s"; protected String missingEntityAnnotation$str() { return missingEntityAnnotation; } @@ -2833,7 +2833,7 @@ public class CoreMessageLogger_$logger extends DelegatingBasicLogger implements public final void multipleValidationModes(final String modes) { super.log.logf(FQCN, Logger.Level.INFO, null, multipleValidationModes$str(), modes); } - private static final String multipleValidationModes = "HHH000448: 'javax.persistence.validation.mode' named multiple values : %s"; + private static final String multipleValidationModes = "HHH000448: 'com.fr.third.javax.persistence.validation.mode' named multiple values : %s"; protected String multipleValidationModes$str() { return multipleValidationModes; } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/SessionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/SessionImpl.java index 8a96dabbe..788f80a1a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/SessionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/SessionImpl.java @@ -25,7 +25,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.EntityNotFoundException; +import com.fr.third.javax.persistence.EntityNotFoundException; import javax.transaction.SystemException; import com.fr.third.org.hibernate.CacheMode; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionAccessLogger.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionAccessLogger.java index 8e857f42d..6c3b17e19 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionAccessLogger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionAccessLogger.java @@ -10,10 +10,10 @@ import com.fr.third.org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAcce import com.fr.third.org.jboss.logging.BasicLogger; import com.fr.third.org.jboss.logging.Logger; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.ValidIdRange; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.ValidIdRange; import static com.fr.third.org.jboss.logging.Logger.Level.INFO; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionPoolingLogger.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionPoolingLogger.java index 503b901ac..f225d8e59 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionPoolingLogger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/ConnectionPoolingLogger.java @@ -11,11 +11,11 @@ import java.util.Properties; import com.fr.third.org.jboss.logging.BasicLogger; import com.fr.third.org.jboss.logging.Logger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.ValidIdRange; +import com.fr.third.org.jboss.logging.annotations.Cause; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.ValidIdRange; import static com.fr.third.org.jboss.logging.Logger.Level.INFO; import static com.fr.third.org.jboss.logging.Logger.Level.WARN; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/DeprecationLogger.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/DeprecationLogger.java index 9ea7d032b..aaf3c1de8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/DeprecationLogger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/DeprecationLogger.java @@ -8,10 +8,10 @@ package com.fr.third.org.hibernate.internal.log; import com.fr.third.org.jboss.logging.BasicLogger; import com.fr.third.org.jboss.logging.Logger; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.ValidIdRange; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.ValidIdRange; import static com.fr.third.org.jboss.logging.Logger.Level.INFO; import static com.fr.third.org.jboss.logging.Logger.Level.WARN; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/UrlMessageBundle.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/UrlMessageBundle.java index 5c84f3afd..bfef998ae 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/UrlMessageBundle.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/log/UrlMessageBundle.java @@ -10,17 +10,17 @@ import java.net.URISyntaxException; import java.net.URL; import com.fr.third.org.jboss.logging.Logger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.ValidIdRange; +import com.fr.third.org.jboss.logging.annotations.Cause; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.ValidIdRange; import static com.fr.third.org.jboss.logging.Logger.Level.WARN; /** - * Acts as the {@link org.jboss.logging.annotations.MessageLogger} and - * {@link org.jboss.logging.annotations.MessageBundle} for messages related to + * Acts as the {@link com.fr.third.org.jboss.logging.annotations.MessageLogger} and + * {@link com.fr.third.org.jboss.logging.annotations.MessageBundle} for messages related to * processing URLs. * * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/internal/util/LockModeConverter.java b/fine-hibernate/src/com/fr/third/org/hibernate/internal/util/LockModeConverter.java index 3263fd4fd..af1d0dfe9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/internal/util/LockModeConverter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/internal/util/LockModeConverter.java @@ -6,14 +6,14 @@ */ package com.fr.third.org.hibernate.internal.util; -import javax.persistence.LockModeType; +import com.fr.third.javax.persistence.LockModeType; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.LockMode; /** * Helper to deal with conversions (both directions) between {@link com.fr.third.org.hibernate.LockMode} and - * {@link javax.persistence.LockModeType}. + * {@link com.fr.third.javax.persistence.LockModeType}. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/AvailableSettings.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/AvailableSettings.java index ebc5b5af6..7e77565ff 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/AvailableSettings.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/AvailableSettings.java @@ -20,32 +20,32 @@ public interface AvailableSettings { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** - * THe name of the {@link javax.persistence.spi.PersistenceProvider} implementor + * THe name of the {@link com.fr.third.javax.persistence.spi.PersistenceProvider} implementor *

    * See JPA 2 sections 9.4.3 and 8.2.1.4 */ - String PROVIDER = "javax.persistence.provider"; + String PROVIDER = "com.fr.third.javax.persistence.provider"; /** * The type of transactions supported by the entity managers. *

    * See JPA 2 sections 9.4.3 and 8.2.1.2 */ - String TRANSACTION_TYPE = "javax.persistence.transactionType"; + String TRANSACTION_TYPE = "com.fr.third.javax.persistence.transactionType"; /** * The JNDI name of a JTA {@link javax.sql.DataSource}. *

    * See JPA 2 sections 9.4.3 and 8.2.1.5 */ - String JTA_DATASOURCE = "javax.persistence.jtaDataSource"; + String JTA_DATASOURCE = "com.fr.third.javax.persistence.jtaDataSource"; /** * The JNDI name of a non-JTA {@link javax.sql.DataSource}. *

    * See JPA 2 sections 9.4.3 and 8.2.1.5 */ - String NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource"; + String NON_JTA_DATASOURCE = "com.fr.third.javax.persistence.nonJtaDataSource"; /** * The name of a JDBC driver to use to connect to the database. @@ -56,7 +56,7 @@ public interface AvailableSettings { *

    * See section 8.2.1.9 */ - String JDBC_DRIVER = "javax.persistence.jdbc.driver"; + String JDBC_DRIVER = "com.fr.third.javax.persistence.jdbc.driver"; /** * The JDBC connection url to use to connect to the database. @@ -67,7 +67,7 @@ public interface AvailableSettings { *

    * See section 8.2.1.9 */ - String JDBC_URL = "javax.persistence.jdbc.url"; + String JDBC_URL = "com.fr.third.javax.persistence.jdbc.url"; /** * The JDBC connection user name. @@ -78,7 +78,7 @@ public interface AvailableSettings { *

    * See section 8.2.1.9 */ - String JDBC_USER = "javax.persistence.jdbc.user"; + String JDBC_USER = "com.fr.third.javax.persistence.jdbc.user"; /** * The JDBC connection password. @@ -89,16 +89,16 @@ public interface AvailableSettings { *

    * See JPA 2 section 8.2.1.9 */ - String JDBC_PASSWORD = "javax.persistence.jdbc.password"; + String JDBC_PASSWORD = "com.fr.third.javax.persistence.jdbc.password"; /** * Used to indicate whether second-level (what JPA terms shared cache) caching is * enabled as per the rules defined in JPA 2 section 3.1.7. *

    * See JPA 2 sections 9.4.3 and 8.2.1.7 - * @see javax.persistence.SharedCacheMode + * @see com.fr.third.javax.persistence.SharedCacheMode */ - String SHARED_CACHE_MODE = "javax.persistence.sharedCache.mode"; + String SHARED_CACHE_MODE = "com.fr.third.javax.persistence.sharedCache.mode"; /** * NOTE : Not a valid EMF property... @@ -106,9 +106,9 @@ public interface AvailableSettings { * Used to indicate if the provider should attempt to retrieve requested data * in the shared cache. * - * @see javax.persistence.CacheRetrieveMode + * @see com.fr.third.javax.persistence.CacheRetrieveMode */ - String SHARED_CACHE_RETRIEVE_MODE ="javax.persistence.cache.retrieveMode"; + String SHARED_CACHE_RETRIEVE_MODE ="com.fr.third.javax.persistence.cache.retrieveMode"; /** * NOTE : Not a valid EMF property... @@ -116,63 +116,63 @@ public interface AvailableSettings { * Used to indicate if the provider should attempt to store data loaded from the database * in the shared cache. * - * @see javax.persistence.CacheStoreMode + * @see com.fr.third.javax.persistence.CacheStoreMode */ - String SHARED_CACHE_STORE_MODE ="javax.persistence.cache.storeMode"; + String SHARED_CACHE_STORE_MODE ="com.fr.third.javax.persistence.cache.storeMode"; /** * Used to indicate what form of automatic validation is in effect as per rules defined * in JPA 2 section 3.6.1.1 *

    * See JPA 2 sections 9.4.3 and 8.2.1.8 - * @see javax.persistence.ValidationMode + * @see com.fr.third.javax.persistence.ValidationMode */ - String VALIDATION_MODE = "javax.persistence.validation.mode"; + String VALIDATION_MODE = "com.fr.third.javax.persistence.validation.mode"; /** * Used to pass along any discovered validator factory. */ - String VALIDATION_FACTORY = "javax.persistence.validation.factory"; + String VALIDATION_FACTORY = "com.fr.third.javax.persistence.validation.factory"; /** * Used to request (hint) a pessimistic lock scope. *

    * See JPA 2 sections 8.2.1.9 and 3.4.4.3 */ - String LOCK_SCOPE = "javax.persistence.lock.scope"; + String LOCK_SCOPE = "com.fr.third.javax.persistence.lock.scope"; /** * Used to request (hint) a pessimistic lock timeout (in milliseconds). *

    * See JPA 2 sections 8.2.1.9 and 3.4.4.3 */ - String LOCK_TIMEOUT = "javax.persistence.lock.timeout"; + String LOCK_TIMEOUT = "com.fr.third.javax.persistence.lock.timeout"; /** * Used to coordinate with bean validators *

    * See JPA 2 section 8.2.1.9 */ - String PERSIST_VALIDATION_GROUP = "javax.persistence.validation.group.pre-persist"; + String PERSIST_VALIDATION_GROUP = "com.fr.third.javax.persistence.validation.group.pre-persist"; /** * Used to coordinate with bean validators *

    * See JPA 2 section 8.2.1.9 */ - String UPDATE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-update"; + String UPDATE_VALIDATION_GROUP = "com.fr.third.javax.persistence.validation.group.pre-update"; /** * Used to coordinate with bean validators *

    * See JPA 2 section 8.2.1.9 */ - String REMOVE_VALIDATION_GROUP = "javax.persistence.validation.group.pre-remove"; + String REMOVE_VALIDATION_GROUP = "com.fr.third.javax.persistence.validation.group.pre-remove"; /** * Used to pass along the CDI BeanManager, if any, to be used. */ - String CDI_BEAN_MANAGER = "javax.persistence.bean.manager"; + String CDI_BEAN_MANAGER = "com.fr.third.javax.persistence.bean.manager"; /** * @see com.fr.third.org.hibernate.cfg.AvailableSettings#HBM2DDL_CREATE_SOURCE @@ -246,7 +246,7 @@ public interface AvailableSettings { *

    * A "SQL load script" is a script that performs some database initialization (INSERT, etc). */ - String SCHEMA_GEN_LOAD_SCRIPT_SOURCE = "javax.persistence.sql-load-script-source"; + String SCHEMA_GEN_LOAD_SCRIPT_SOURCE = "com.fr.third.javax.persistence.sql-load-script-source"; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -254,10 +254,10 @@ public interface AvailableSettings { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** - * Query hint (aka {@link javax.persistence.Query#setHint}) for applying + * Query hint (aka {@link com.fr.third.javax.persistence.Query#setHint}) for applying * an alias specific lock mode (aka {@link com.fr.third.org.hibernate.Query#setLockMode}). *

    - * Either {@link com.fr.third.org.hibernate.LockMode} or {@link javax.persistence.LockModeType} + * Either {@link com.fr.third.org.hibernate.LockMode} or {@link com.fr.third.javax.persistence.LockModeType} * are accepted. Also the String names of either are accepted as well. null * is additionally accepted as meaning {@link com.fr.third.org.hibernate.LockMode#NONE}. *

    diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManager.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManager.java index fe4212640..857284c6f 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManager.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManager.java @@ -6,19 +6,19 @@ */ package com.fr.third.org.hibernate.jpa; -import javax.persistence.EntityManager; +import com.fr.third.javax.persistence.EntityManager; import com.fr.third.org.hibernate.Session; /** - * Additional contract for Hibernate implementations of {@link javax.persistence.EntityManager} providing access to various Hibernate + * Additional contract for Hibernate implementations of {@link com.fr.third.javax.persistence.EntityManager} providing access to various Hibernate * specific functionality. * * @author Gavin King */ public interface HibernateEntityManager extends EntityManager { /** - * Retrieve a reference to the Hibernate {@link com.fr.third.org.hibernate.Session} used by this {@link javax.persistence.EntityManager}. + * Retrieve a reference to the Hibernate {@link com.fr.third.org.hibernate.Session} used by this {@link com.fr.third.javax.persistence.EntityManager}. * * @return The session */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManagerFactory.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManagerFactory.java index 7cd406809..82e5d5f0b 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManagerFactory.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateEntityManagerFactory.java @@ -8,14 +8,14 @@ package com.fr.third.org.hibernate.jpa; import java.io.Serializable; import java.util.List; -import javax.persistence.EntityGraph; -import javax.persistence.EntityManagerFactory; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; /** - * Contract giving access to the underlying {@link com.fr.third.org.hibernate.SessionFactory} from an {@link javax.persistence.EntityManagerFactory} + * Contract giving access to the underlying {@link com.fr.third.org.hibernate.SessionFactory} from an {@link com.fr.third.javax.persistence.EntityManagerFactory} * * @author Gavin King */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernatePersistenceProvider.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernatePersistenceProvider.java index 142fbf7c2..a9bee95a8 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernatePersistenceProvider.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernatePersistenceProvider.java @@ -9,12 +9,12 @@ package com.fr.third.org.hibernate.jpa; import java.util.Collections; import java.util.List; import java.util.Map; -import javax.persistence.EntityManagerFactory; -import javax.persistence.PersistenceException; -import javax.persistence.spi.LoadState; -import javax.persistence.spi.PersistenceProvider; -import javax.persistence.spi.PersistenceUnitInfo; -import javax.persistence.spi.ProviderUtil; +import com.fr.third.javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.spi.LoadState; +import com.fr.third.javax.persistence.spi.PersistenceProvider; +import com.fr.third.javax.persistence.spi.PersistenceUnitInfo; +import com.fr.third.javax.persistence.spi.ProviderUtil; import com.fr.third.org.hibernate.jpa.boot.internal.ParsedPersistenceXmlDescriptor; import com.fr.third.org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateQuery.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateQuery.java index e5350e3d0..9738abe0c 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateQuery.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/HibernateQuery.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa; -import javax.persistence.Query; +import com.fr.third.javax.persistence.Query; /** * Marker interface for Hibernate generated JPA queries so that we can access the underlying Hibernate query objects. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java index 0fd1a63ff..6006f72e1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java @@ -15,11 +15,11 @@ import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.AttributeConverter; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityNotFoundException; -import javax.persistence.PersistenceException; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.EntityNotFoundException; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import javax.sql.DataSource; import javassist.CtClass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/Helper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/Helper.java index def0dd92c..e397b8e10 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/Helper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/Helper.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.boot.internal; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/ParsedPersistenceXmlDescriptor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/ParsedPersistenceXmlDescriptor.java index d4af6a2f0..6309a586f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/ParsedPersistenceXmlDescriptor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/ParsedPersistenceXmlDescriptor.java @@ -11,16 +11,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Properties; -import javax.persistence.SharedCacheMode; -import javax.persistence.ValidationMode; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.ValidationMode; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.bytecode.enhance.spi.EnhancementContext; /** * Describes the information gleaned from a {@code } element in a {@code persistence.xml} file * whether parsed directly by Hibernate or passed to us by an EE container as a - * {@link javax.persistence.spi.PersistenceUnitInfo}. + * {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo}. * * Easier to consolidate both views into a single contract and extract information through that shared contract. * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceUnitInfoDescriptor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceUnitInfoDescriptor.java index 769ef1be7..f9bdc62d5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceUnitInfoDescriptor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceUnitInfoDescriptor.java @@ -9,10 +9,10 @@ package com.fr.third.org.hibernate.jpa.boot.internal; import java.net.URL; import java.util.List; import java.util.Properties; -import javax.persistence.SharedCacheMode; -import javax.persistence.ValidationMode; -import javax.persistence.spi.PersistenceUnitInfo; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.ValidationMode; +import com.fr.third.javax.persistence.spi.PersistenceUnitInfo; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.bytecode.enhance.spi.EnhancementContext; import com.fr.third.org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java index b5058f6ab..f73bf9cf8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/PersistenceXmlParser.java @@ -14,8 +14,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; -import javax.persistence.PersistenceException; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/SettingsImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/SettingsImpl.java index 77da49f00..809124ade 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/SettingsImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/internal/SettingsImpl.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.boot.internal; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.Interceptor; import com.fr.third.org.hibernate.jpa.boot.spi.Settings; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Bootstrap.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Bootstrap.java index 5c7267068..dee79f314 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Bootstrap.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Bootstrap.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.boot.spi; import java.util.Map; -import javax.persistence.spi.PersistenceUnitInfo; +import com.fr.third.javax.persistence.spi.PersistenceUnitInfo; import com.fr.third.org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl; import com.fr.third.org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/EntityManagerFactoryBuilder.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/EntityManagerFactoryBuilder.java index d3499ffdb..aeae27bb0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/EntityManagerFactoryBuilder.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/EntityManagerFactoryBuilder.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.boot.spi; -import javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.EntityManagerFactory; import javax.sql.DataSource; /** diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/PersistenceUnitDescriptor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/PersistenceUnitDescriptor.java index 5a3334e77..0aa565ae5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/PersistenceUnitDescriptor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/PersistenceUnitDescriptor.java @@ -9,15 +9,15 @@ package com.fr.third.org.hibernate.jpa.boot.spi; import java.net.URL; import java.util.List; import java.util.Properties; -import javax.persistence.SharedCacheMode; -import javax.persistence.ValidationMode; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.ValidationMode; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.bytecode.enhance.spi.EnhancementContext; /** * Abstraction for dealing with either {@code } information whether that comes from - * an EE container in the form of {@link javax.persistence.spi.PersistenceUnitInfo} or in an SE environment + * an EE container in the form of {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo} or in an SE environment * where Hibernate has parsed the {@code persistence.xml} file itself. * * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/ProviderChecker.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/ProviderChecker.java index 6865ce131..d32a4a34b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/ProviderChecker.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/ProviderChecker.java @@ -16,7 +16,7 @@ import com.fr.third.org.jboss.logging.Logger; /** * Helper for handling checks to see whether Hibernate is the requested - * {@link javax.persistence.spi.PersistenceProvider} + * {@link com.fr.third.javax.persistence.spi.PersistenceProvider} * * @author Steve Ebersole */ @@ -31,7 +31,7 @@ public final class ProviderChecker { /** * Does the descriptor and/or integration request Hibernate as the - * {@link javax.persistence.spi.PersistenceProvider}? Note that in the case of no requested provider being named + * {@link com.fr.third.javax.persistence.spi.PersistenceProvider}? Note that in the case of no requested provider being named * we assume we are the provider (the calls got to us somehow...) * * @param persistenceUnit The {@code } descriptor. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Settings.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Settings.java index 134fd8494..54840eb79 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Settings.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/boot/spi/Settings.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.boot.spi; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.Interceptor; @@ -17,7 +17,7 @@ public interface Settings { public PersistenceUnitTransactionType getTransactionType(); /** - * Should resources held by {@link javax.persistence.EntityManager} instance be released immediately on close? + * Should resources held by {@link com.fr.third.javax.persistence.EntityManager} instance be released immediately on close? *

    * The other option is to release them as part of an after-transaction callback. * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/AbstractManipulationCriteriaQuery.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/AbstractManipulationCriteriaQuery.java index af4c02d12..80f80f78a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/AbstractManipulationCriteriaQuery.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/AbstractManipulationCriteriaQuery.java @@ -9,13 +9,13 @@ package com.fr.third.org.hibernate.jpa.criteria; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.Query; -import javax.persistence.criteria.CommonAbstractCriteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import javax.persistence.criteria.Subquery; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.criteria.CommonAbstractCriteria; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.jpa.criteria.compile.CompilableCriteria; import com.fr.third.org.hibernate.jpa.criteria.compile.CriteriaInterpretation; @@ -27,8 +27,8 @@ import com.fr.third.org.hibernate.jpa.internal.QueryImpl; import com.fr.third.org.hibernate.jpa.spi.HibernateEntityManagerImplementor; /** - * Base class for commonality between {@link javax.persistence.criteria.CriteriaUpdate} and - * {@link javax.persistence.criteria.CriteriaDelete} + * Base class for commonality between {@link com.fr.third.javax.persistence.criteria.CriteriaUpdate} and + * {@link com.fr.third.javax.persistence.criteria.CriteriaDelete} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/BasicPathUsageException.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/BasicPathUsageException.java index 4e398deb8..8a6f0b668 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/BasicPathUsageException.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/BasicPathUsageException.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Attribute; /** * Represents an incorrect usage of a basic path. Generally this means an attempt to diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CollectionJoinImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CollectionJoinImplementor.java index c99f906e6..aaf3d939a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CollectionJoinImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CollectionJoinImplementor.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.CollectionJoin; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.CollectionJoin; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; /** * Specialization of {@link JoinImplementor} for {@link java.util.Collection} typed attribute joins diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaBuilderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaBuilderImpl.java index 3e6a18315..c00e4d443 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaBuilderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaBuilderImpl.java @@ -15,25 +15,25 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.Tuple; -import javax.persistence.criteria.CollectionJoin; -import javax.persistence.criteria.CompoundSelection; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaDelete; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.CriteriaUpdate; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.ListJoin; -import javax.persistence.criteria.MapJoin; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.ParameterExpression; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import javax.persistence.criteria.Selection; -import javax.persistence.criteria.SetJoin; -import javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.Tuple; +import com.fr.third.javax.persistence.criteria.CollectionJoin; +import com.fr.third.javax.persistence.criteria.CompoundSelection; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder; +import com.fr.third.javax.persistence.criteria.CriteriaDelete; +import com.fr.third.javax.persistence.criteria.CriteriaQuery; +import com.fr.third.javax.persistence.criteria.CriteriaUpdate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Join; +import com.fr.third.javax.persistence.criteria.ListJoin; +import com.fr.third.javax.persistence.criteria.MapJoin; +import com.fr.third.javax.persistence.criteria.Order; +import com.fr.third.javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.SetJoin; +import com.fr.third.javax.persistence.criteria.Subquery; import com.fr.third.org.hibernate.internal.util.StringHelper; import com.fr.third.org.hibernate.internal.util.collections.CollectionHelper; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaDeleteImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaDeleteImpl.java index 16790aa97..1373f7591 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaDeleteImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaDeleteImpl.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.CriteriaDelete; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.CriteriaDelete; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaQueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaQueryImpl.java index fbb7b476c..95b1d0b0c 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaQueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaQueryImpl.java @@ -13,17 +13,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.Query; -import javax.persistence.Tuple; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.ParameterExpression; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import javax.persistence.criteria.Selection; -import javax.persistence.criteria.Subquery; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.Tuple; +import com.fr.third.javax.persistence.criteria.CriteriaQuery; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Order; +import com.fr.third.javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.jpa.criteria.compile.CompilableCriteria; import com.fr.third.org.hibernate.jpa.criteria.compile.CriteriaInterpretation; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaSubqueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaSubqueryImpl.java index d1b950020..ed08ff9ad 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaSubqueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaSubqueryImpl.java @@ -9,19 +9,19 @@ package com.fr.third.org.hibernate.jpa.criteria; import java.io.Serializable; import java.util.List; import java.util.Set; -import javax.persistence.criteria.AbstractQuery; -import javax.persistence.criteria.CollectionJoin; -import javax.persistence.criteria.CommonAbstractCriteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.ListJoin; -import javax.persistence.criteria.MapJoin; -import javax.persistence.criteria.ParameterExpression; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import javax.persistence.criteria.SetJoin; -import javax.persistence.criteria.Subquery; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.criteria.AbstractQuery; +import com.fr.third.javax.persistence.criteria.CollectionJoin; +import com.fr.third.javax.persistence.criteria.CommonAbstractCriteria; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Join; +import com.fr.third.javax.persistence.criteria.ListJoin; +import com.fr.third.javax.persistence.criteria.MapJoin; +import com.fr.third.javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.SetJoin; +import com.fr.third.javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.expression.DelegatedExpressionImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaUpdateImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaUpdateImpl.java index e332c7dd0..f6bac0f26 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaUpdateImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/CriteriaUpdateImpl.java @@ -8,11 +8,11 @@ package com.fr.third.org.hibernate.jpa.criteria; import java.util.ArrayList; import java.util.List; -import javax.persistence.criteria.CriteriaUpdate; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.criteria.CriteriaUpdate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.path.SingularAttributePath; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ExpressionImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ExpressionImplementor.java index 52dc2c04c..fd27d7abf 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ExpressionImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ExpressionImplementor.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.jpa.criteria; import java.math.BigDecimal; import java.math.BigInteger; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; /** * Internal contract for implementations of the JPA {@link Expression} contract. @@ -17,49 +17,49 @@ import javax.persistence.criteria.Expression; */ public interface ExpressionImplementor extends SelectionImplementor, Expression, Renderable { /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toLong} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toLong} * * @return this but as a long */ public ExpressionImplementor asLong(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toInteger} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toInteger} * * @return this but as an integer */ public ExpressionImplementor asInteger(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toFloat} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toFloat} * * @return this but as a float */ public ExpressionImplementor asFloat(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toDouble} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toDouble} * * @return this but as a double */ public ExpressionImplementor asDouble(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toBigDecimal} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toBigDecimal} * * @return this but as a {@link BigDecimal} */ public ExpressionImplementor asBigDecimal(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toBigInteger} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toBigInteger} * * @return this but as a {@link BigInteger} */ public ExpressionImplementor asBigInteger(); /** - * See {@link javax.persistence.criteria.CriteriaBuilder#toString} + * See {@link com.fr.third.javax.persistence.criteria.CriteriaBuilder#toString} * * @return this but as a string */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/FromImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/FromImplementor.java index 041a934b3..3a2101d4e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/FromImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/FromImplementor.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.From; +import com.fr.third.javax.persistence.criteria.From; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/JoinImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/JoinImplementor.java index d34967901..92bb4af64 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/JoinImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/JoinImplementor.java @@ -6,10 +6,10 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Fetch; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Fetch; +import com.fr.third.javax.persistence.criteria.Join; +import com.fr.third.javax.persistence.criteria.Predicate; /** * Consolidates the {@link Join} and {@link Fetch} hierarchies since that is how we implement them. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ListJoinImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ListJoinImplementor.java index 6a6adf747..08230b0cc 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ListJoinImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ListJoinImplementor.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.ListJoin; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.ListJoin; +import com.fr.third.javax.persistence.criteria.Predicate; /** * Specialization of {@link JoinImplementor} for {@link java.util.List} typed attribute joins diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/MapJoinImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/MapJoinImplementor.java index 64c9cf0b1..23023ba1b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/MapJoinImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/MapJoinImplementor.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.MapJoin; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.MapJoin; +import com.fr.third.javax.persistence.criteria.Predicate; /** * Specialization of {@link JoinImplementor} for {@link java.util.Map} typed attribute joins diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/OrderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/OrderImpl.java index cc4f012dd..e82d2463c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/OrderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/OrderImpl.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.jpa.criteria; import java.io.Serializable; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Order; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Order; /** * Represents an ORDER BY fragment. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterContainer.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterContainer.java index cfd0d7dab..6485c1b8f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterContainer.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterContainer.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Selection; /** * Contract for query components capable of eirther being a parameter or containing parameters. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterRegistry.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterRegistry.java index 8df4d2883..10293e171 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterRegistry.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/ParameterRegistry.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.ParameterExpression; /** * A registry for parameters. In criteria queries, parameters must be actively seeked out as expressions and predicates diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathImplementor.java index 453f11342..b41709984 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathImplementor.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Path; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.metamodel.Attribute; /** * Implementation contract for the JPA {@link Path} interface. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathSource.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathSource.java index a7b428505..a71d54c7f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathSource.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/PathSource.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.criteria.Path; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/QueryStructure.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/QueryStructure.java index f7b96adef..c84141b8d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/QueryStructure.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/QueryStructure.java @@ -15,25 +15,25 @@ import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import javax.persistence.criteria.AbstractQuery; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Fetch; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.ParameterExpression; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import javax.persistence.criteria.Selection; -import javax.persistence.criteria.Subquery; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.criteria.AbstractQuery; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Fetch; +import com.fr.third.javax.persistence.criteria.Join; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.path.RootImpl; /** * Models basic query structure. Used as a delegate in implementing both - * {@link javax.persistence.criteria.CriteriaQuery} and - * {@link javax.persistence.criteria.Subquery}. + * {@link com.fr.third.javax.persistence.criteria.CriteriaQuery} and + * {@link com.fr.third.javax.persistence.criteria.Subquery}. *

    * Note the ORDER BY specs are neglected here. That's because it is not valid * for a subquery to define an ORDER BY clause. So we just handle them on the diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SelectionImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SelectionImplementor.java index a2986022d..acdb4bb74 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SelectionImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SelectionImplementor.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria; import java.util.List; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Selection; /** * TODO : javadoc diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SetJoinImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SetJoinImplementor.java index 93040d15a..0793ba3de 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SetJoinImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/SetJoinImplementor.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.SetJoin; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.SetJoin; /** * Specialization of {@link JoinImplementor} for {@link java.util.Set} typed attribute joins diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/TupleElementImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/TupleElementImplementor.java index d460f0a42..4254c7436 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/TupleElementImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/TupleElementImplementor.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria; -import javax.persistence.TupleElement; +import com.fr.third.javax.persistence.TupleElement; /** * TODO : javadoc diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaCompiler.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaCompiler.java index 725073338..3fdb9537a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaCompiler.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaCompiler.java @@ -11,9 +11,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.criteria.ParameterExpression; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.internal.util.StringHelper; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaInterpretation.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaInterpretation.java index e5d777dec..0f63e96c6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaInterpretation.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaInterpretation.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria.compile; -import javax.persistence.Query; +import com.fr.third.javax.persistence.Query; import com.fr.third.org.hibernate.jpa.spi.HibernateEntityManagerImplementor; @@ -17,7 +17,7 @@ import com.fr.third.org.hibernate.jpa.spi.HibernateEntityManagerImplementor; */ public interface CriteriaInterpretation { /** - * Generate a {@link javax.persistence.Query} instance given the interpreted criteria compiled against the + * Generate a {@link com.fr.third.javax.persistence.Query} instance given the interpreted criteria compiled against the * passed EntityManager. * * diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaQueryTypeQueryAdapter.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaQueryTypeQueryAdapter.java index f13a67efd..3367e2c22 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaQueryTypeQueryAdapter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/CriteriaQueryTypeQueryAdapter.java @@ -12,12 +12,12 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.Parameter; -import javax.persistence.TemporalType; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.Parameter; +import com.fr.third.javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.criteria.ParameterExpression; import com.fr.third.org.hibernate.Query; import com.fr.third.org.hibernate.ejb.HibernateQuery; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ExplicitParameterInfo.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ExplicitParameterInfo.java index b4c8816eb..baad7054e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ExplicitParameterInfo.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ExplicitParameterInfo.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.jpa.criteria.compile; import java.util.Calendar; import java.util.Date; -import javax.persistence.Parameter; +import com.fr.third.javax.persistence.Parameter; /** * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ImplicitParameterBinding.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ImplicitParameterBinding.java index ef07503b8..703511980 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ImplicitParameterBinding.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/ImplicitParameterBinding.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria.compile; -import javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.TypedQuery; /** * Used to describe implicit (not defined in criteria query) parameters. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/InterpretedParameterMetadata.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/InterpretedParameterMetadata.java index 60b4127e5..52b5afbf9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/InterpretedParameterMetadata.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/InterpretedParameterMetadata.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.jpa.criteria.compile; import java.util.List; import java.util.Map; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.ParameterExpression; /** * Represents information about parameters from a compiled criteria query. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/RenderingContext.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/RenderingContext.java index 86b3c60a5..d3f4a39ac 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/RenderingContext.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/compile/RenderingContext.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria.compile; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.ParameterExpression; /** * Used to provide a context and services to the rendering. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryArithmeticOperation.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryArithmeticOperation.java index 8ee073afc..602ce24ef 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryArithmeticOperation.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryArithmeticOperation.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryOperatorExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryOperatorExpression.java index 993bd708e..326f146d1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryOperatorExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/BinaryOperatorExpression.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria.expression; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; /** * Contract for operators with two operands. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CoalesceExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CoalesceExpression.java index 760b0e666..472f70e09 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CoalesceExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CoalesceExpression.java @@ -9,8 +9,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder.Coalesce; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder.Coalesce; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CompoundSelectionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CompoundSelectionImpl.java index 85d133be2..d507aa3c4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CompoundSelectionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/CompoundSelectionImpl.java @@ -9,9 +9,9 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.Tuple; -import javax.persistence.criteria.CompoundSelection; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.Tuple; +import com.fr.third.javax.persistence.criteria.CompoundSelection; +import com.fr.third.javax.persistence.criteria.Selection; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ConcatExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ConcatExpression.java index 68926d09a..8d50932ec 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ConcatExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ConcatExpression.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/DelegatedExpressionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/DelegatedExpressionImpl.java index 180e90f7c..587b9942f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/DelegatedExpressionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/DelegatedExpressionImpl.java @@ -7,13 +7,13 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.util.List; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Selection; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; import com.fr.third.org.hibernate.jpa.criteria.ValueHandlerFactory; /** - * Implementation of {@link javax.persistence.criteria.Expression} wraps another Expression and delegates most of its + * Implementation of {@link com.fr.third.javax.persistence.criteria.Expression} wraps another Expression and delegates most of its * functionality to that wrapped Expression * * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ExpressionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ExpressionImpl.java index acc1500e1..99873111c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ExpressionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ExpressionImpl.java @@ -10,8 +10,8 @@ import java.io.Serializable; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Collection; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ExpressionImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ListIndexExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ListIndexExpression.java index 21fcd81ae..f7de5a02a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ListIndexExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ListIndexExpression.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.ListAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/MapEntryExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/MapEntryExpression.java index 3347a577d..942fc711b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/MapEntryExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/MapEntryExpression.java @@ -8,8 +8,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.Map; -import javax.persistence.criteria.Expression; -import javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.metamodel.MapAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/NullifExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/NullifExpression.java index 833f0011c..c923180a1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/NullifExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/NullifExpression.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ParameterExpressionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ParameterExpressionImpl.java index 2d467c759..1c69e2f6d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ParameterExpressionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/ParameterExpressionImpl.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.ParameterExpression; +import com.fr.third.javax.persistence.criteria.ParameterExpression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/PathTypeExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/PathTypeExpression.java index bdbb68e1d..fb5ba3e18 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/PathTypeExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/PathTypeExpression.java @@ -14,7 +14,7 @@ import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.path.AbstractPathImpl; /** - * Used to construct the result of {@link javax.persistence.criteria.Path#type()} + * Used to construct the result of {@link com.fr.third.javax.persistence.criteria.Path#type()} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SearchedCaseExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SearchedCaseExpression.java index 8bd60948b..1ec010e44 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SearchedCaseExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SearchedCaseExpression.java @@ -9,8 +9,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder.Case; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder.Case; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SelectionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SelectionImpl.java index dc5bf7814..eae2287d0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SelectionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SelectionImpl.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.Collections; import java.util.List; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Selection; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterContainer; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SimpleCaseExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SimpleCaseExpression.java index cc69ba568..4215c3ecf 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SimpleCaseExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SimpleCaseExpression.java @@ -9,8 +9,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.criteria.CriteriaBuilder.SimpleCase; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder.SimpleCase; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SubqueryComparisonModifierExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SubqueryComparisonModifierExpression.java index 8f49a05cf..6567c5aa4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SubqueryComparisonModifierExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/SubqueryComparisonModifierExpression.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.criteria.Subquery; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryArithmeticOperation.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryArithmeticOperation.java index 438b2466c..58b76e217 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryArithmeticOperation.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryArithmeticOperation.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryOperatorExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryOperatorExpression.java index 3e931404b..09a1a7c45 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryOperatorExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/UnaryOperatorExpression.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria.expression; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; /** * Contract for operators with a single operand. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AbsFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AbsFunction.java index ea5b1644f..2c66062dc 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AbsFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AbsFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AggregationFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AggregationFunction.java index b8e519064..7d85095d1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AggregationFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/AggregationFunction.java @@ -8,8 +8,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; import java.util.List; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Root; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/FunctionExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/FunctionExpression.java index f6a662c12..c7da2e0dc 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/FunctionExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/FunctionExpression.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.criteria.expression.function; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; /** * Contract for expressions which model a SQL function call. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LengthFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LengthFunction.java index 85a1ffc69..1642bc959 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LengthFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LengthFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LocateFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LocateFunction.java index de924f94f..94f66919e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LocateFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LocateFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LowerFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LowerFunction.java index fa2a5debb..075dab1de 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LowerFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/LowerFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/ParameterizedFunctionExpression.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/ParameterizedFunctionExpression.java index c06d7e545..3913fa1f3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/ParameterizedFunctionExpression.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/ParameterizedFunctionExpression.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.util.Arrays; import java.util.List; import java.util.Locale; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterContainer; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SqrtFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SqrtFunction.java index 5b89ea983..00c5c8c16 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SqrtFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SqrtFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SubstringFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SubstringFunction.java index c13a5451c..6ec641414 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SubstringFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/SubstringFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/TrimFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/TrimFunction.java index 78d437960..85a7dde99 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/TrimFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/TrimFunction.java @@ -7,8 +7,8 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.CriteriaBuilder.Trimspec; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder.Trimspec; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/UpperFunction.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/UpperFunction.java index c2f0cee09..63cd83c5a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/UpperFunction.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/expression/function/UpperFunction.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.expression.function; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractFromImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractFromImpl.java index d768bfd08..86068b52c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractFromImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractFromImpl.java @@ -10,23 +10,23 @@ import java.io.Serializable; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; -import javax.persistence.criteria.CollectionJoin; -import javax.persistence.criteria.Fetch; -import javax.persistence.criteria.From; -import javax.persistence.criteria.Join; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.ListJoin; -import javax.persistence.criteria.MapJoin; -import javax.persistence.criteria.SetJoin; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.CollectionAttribute; -import javax.persistence.metamodel.ListAttribute; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SetAttribute; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.criteria.CollectionJoin; +import com.fr.third.javax.persistence.criteria.Fetch; +import com.fr.third.javax.persistence.criteria.From; +import com.fr.third.javax.persistence.criteria.Join; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.ListJoin; +import com.fr.third.javax.persistence.criteria.MapJoin; +import com.fr.third.javax.persistence.criteria.SetJoin; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SetAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.jpa.criteria.BasicPathUsageException; import com.fr.third.org.hibernate.jpa.criteria.CollectionJoinImplementor; @@ -41,7 +41,7 @@ import com.fr.third.org.hibernate.jpa.criteria.SetJoinImplementor; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; /** - * Convenience base class for various {@link javax.persistence.criteria.From} implementations. + * Convenience base class for various {@link com.fr.third.javax.persistence.criteria.From} implementations. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractJoinImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractJoinImpl.java index f874da6dc..000066525 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractJoinImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractJoinImpl.java @@ -7,11 +7,11 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.From; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.From; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.Attribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; @@ -22,7 +22,7 @@ import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.predicate.AbstractPredicateImpl; /** - * Convenience base class for various {@link javax.persistence.criteria.Join} implementations. + * Convenience base class for various {@link com.fr.third.javax.persistence.criteria.Join} implementations. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractPathImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractPathImpl.java index 96590d74c..d36bcd2d5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractPathImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/AbstractPathImpl.java @@ -10,12 +10,12 @@ import java.io.Serializable; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Path; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/CollectionAttributeJoin.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/CollectionAttributeJoin.java index 3eb8c0b13..e94be39f4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/CollectionAttributeJoin.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/CollectionAttributeJoin.java @@ -8,11 +8,11 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; import java.util.Collection; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.CollectionAttribute; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.jpa.criteria.CollectionJoinImplementor; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/ListAttributeJoin.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/ListAttributeJoin.java index c43c0446b..d0fcd1e21 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/ListAttributeJoin.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/ListAttributeJoin.java @@ -8,11 +8,11 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; import java.util.List; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.ListAttribute; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapAttributeJoin.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapAttributeJoin.java index 60c8a9f88..3f944b54e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapAttributeJoin.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapAttributeJoin.java @@ -8,12 +8,12 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; import java.util.Map; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.Path; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.MapAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapKeyHelpers.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapKeyHelpers.java index 42337e279..059cb6ff8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapKeyHelpers.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/MapKeyHelpers.java @@ -9,12 +9,12 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; import java.lang.reflect.Member; import java.util.Map; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.Bindable; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; @@ -25,8 +25,8 @@ import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.persister.collection.CollectionPersister; /** - * {@link javax.persistence.criteria.MapJoin#key} poses a number of implementation difficulties in terms of the - * type signatures amongst the {@link javax.persistence.criteria.Path}, {@link javax.persistence.criteria.Join} and + * {@link com.fr.third.javax.persistence.criteria.MapJoin#key} poses a number of implementation difficulties in terms of the + * type signatures amongst the {@link com.fr.third.javax.persistence.criteria.Path}, {@link com.fr.third.javax.persistence.criteria.Join} and * {@link Attribute}. The implementations found here provide that bridge. * * @author Steve Ebersole @@ -39,7 +39,7 @@ public class MapKeyHelpers { } /** - * Models a path to a map key. This is the actual return used from {@link javax.persistence.criteria.MapJoin#key} + * Models a path to a map key. This is the actual return used from {@link com.fr.third.javax.persistence.criteria.MapJoin#key} * * @param The type of the map key. */ @@ -179,7 +179,7 @@ public class MapKeyHelpers { } /** - * Defines an {@link javax.persistence.metamodel.Attribute} modelling of a map-key. + * Defines an {@link com.fr.third.javax.persistence.metamodel.Attribute} modelling of a map-key. * * @param The type of the map key */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributeJoinSupport.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributeJoinSupport.java index 88ab9e86f..987cd0c1f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributeJoinSupport.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributeJoinSupport.java @@ -6,14 +6,14 @@ */ package com.fr.third.org.hibernate.jpa.criteria.path; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.PluralJoin; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.PluralJoin; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.JoinImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributePath.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributePath.java index 2f1fd184f..613e68a93 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributePath.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/PluralAttributePath.java @@ -7,12 +7,12 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.Bindable; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; @@ -21,7 +21,7 @@ import com.fr.third.org.hibernate.persister.collection.CollectionPersister; /** * Models a path for a {@link PluralAttribute} generally obtained from a - * {@link javax.persistence.criteria.Path#get} call + * {@link com.fr.third.javax.persistence.criteria.Path#get} call * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/RootImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/RootImpl.java index 8b59a20f1..bf131998d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/RootImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/RootImpl.java @@ -7,8 +7,8 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; -import javax.persistence.criteria.Root; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.criteria.Root; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SetAttributeJoin.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SetAttributeJoin.java index 2f8630d92..503c88422 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SetAttributeJoin.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SetAttributeJoin.java @@ -8,11 +8,11 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; import java.util.Set; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.JoinType; -import javax.persistence.criteria.Predicate; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.SetAttribute; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.SetAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributeJoin.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributeJoin.java index 6e33e4f0f..21a5ac2ed 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributeJoin.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributeJoin.java @@ -6,13 +6,13 @@ */ package com.fr.third.org.hibernate.jpa.criteria.path; -import javax.persistence.criteria.JoinType; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.Bindable; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.criteria.JoinType; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.CriteriaSubqueryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributePath.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributePath.java index c3f802e50..2b0078bf4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributePath.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/path/SingularAttributePath.java @@ -7,12 +7,12 @@ package com.fr.third.org.hibernate.jpa.criteria.path; import java.io.Serializable; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.Bindable; -import javax.persistence.metamodel.EmbeddableType; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.EmbeddableType; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.PathSource; @@ -20,7 +20,7 @@ import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; /** * Models a path for a {@link SingularAttribute} generally obtained from a - * {@link javax.persistence.criteria.Path#get(SingularAttribute)} call + * {@link com.fr.third.javax.persistence.criteria.Path#get(SingularAttribute)} call * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractPredicateImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractPredicateImpl.java index 7bc8b3135..8627c5e95 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractPredicateImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractPredicateImpl.java @@ -8,8 +8,8 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; import java.util.List; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Selection; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.expression.ExpressionImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractSimplePredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractSimplePredicate.java index 8b099ea8f..6ba2b56cb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractSimplePredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/AbstractSimplePredicate.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; import java.util.Collections; import java.util.List; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BetweenPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BetweenPredicate.java index 9080760b9..f4e12c4df 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BetweenPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BetweenPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; @@ -15,7 +15,7 @@ import com.fr.third.org.hibernate.jpa.criteria.Renderable; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; /** - * Models a BETWEEN {@link javax.persistence.criteria.Predicate}. + * Models a BETWEEN {@link com.fr.third.javax.persistence.criteria.Predicate}. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanAssertionPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanAssertionPredicate.java index d6545c17a..f10259341 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanAssertionPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanAssertionPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanExpressionPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanExpressionPredicate.java index 6f0f01c8f..d4947a8f5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanExpressionPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/BooleanExpressionPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; @@ -15,7 +15,7 @@ import com.fr.third.org.hibernate.jpa.criteria.Renderable; import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; /** - * Defines a {@link javax.persistence.criteria.Predicate} used to wrap an {@link Expression Expression<Boolean>}. + * Defines a {@link com.fr.third.javax.persistence.criteria.Predicate} used to wrap an {@link Expression Expression<Boolean>}. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ComparisonPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ComparisonPredicate.java index 355eddf34..59a466c23 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ComparisonPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ComparisonPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/CompoundPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/CompoundPredicate.java index bb63de445..d9e4c02ef 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/CompoundPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/CompoundPredicate.java @@ -10,8 +10,8 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExistsPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExistsPredicate.java index c922874f8..db7746710 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExistsPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExistsPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.criteria.Subquery; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExplicitTruthValueCheck.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExplicitTruthValueCheck.java index 7f965e2ff..c2ed94dbb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExplicitTruthValueCheck.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/ExplicitTruthValueCheck.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/InPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/InPredicate.java index 0ae7be455..50bcb7661 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/InPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/InPredicate.java @@ -11,8 +11,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Subquery; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Subquery; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/LikePredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/LikePredicate.java index 93842da0b..17703d6a3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/LikePredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/LikePredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/MemberOfPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/MemberOfPredicate.java index f99206246..e22108f24 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/MemberOfPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/MemberOfPredicate.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; import java.util.Collection; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NegatedPredicateWrapper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NegatedPredicateWrapper.java index 1e2ee0a11..8fd582321 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NegatedPredicateWrapper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NegatedPredicateWrapper.java @@ -10,8 +10,8 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.persistence.criteria.Expression; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Predicate; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterContainer; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NullnessPredicate.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NullnessPredicate.java index c7a8172ce..fda0248a0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NullnessPredicate.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/NullnessPredicate.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.criteria.predicate; import java.io.Serializable; -import javax.persistence.criteria.Expression; +import com.fr.third.javax.persistence.criteria.Expression; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.ParameterRegistry; @@ -16,7 +16,7 @@ import com.fr.third.org.hibernate.jpa.criteria.compile.RenderingContext; import com.fr.third.org.hibernate.jpa.criteria.expression.UnaryOperatorExpression; /** - * Defines a {@link javax.persistence.criteria.Predicate} for checking the + * Defines a {@link com.fr.third.javax.persistence.criteria.Predicate} for checking the * nullness state of an expression, aka an IS [NOT] NULL predicate. *

    * The NOT NULL form can be built by calling the constructor and then diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/PredicateImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/PredicateImplementor.java index 3775173cf..f13353529 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/PredicateImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/criteria/predicate/PredicateImplementor.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.criteria.predicate; -import javax.persistence.criteria.Predicate; +import com.fr.third.javax.persistence.criteria.Predicate; import com.fr.third.org.hibernate.jpa.criteria.CriteriaBuilderImpl; import com.fr.third.org.hibernate.jpa.criteria.Renderable; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackBuilderLegacyImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackBuilderLegacyImpl.java index e7de3b3cb..32feb6cf6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackBuilderLegacyImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackBuilderLegacyImpl.java @@ -12,12 +12,12 @@ import java.lang.annotation.Target; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.ExcludeDefaultListeners; -import javax.persistence.ExcludeSuperclassListeners; -import javax.persistence.MappedSuperclass; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.EntityListeners; +import com.fr.third.javax.persistence.ExcludeDefaultListeners; +import com.fr.third.javax.persistence.ExcludeSuperclassListeners; +import com.fr.third.javax.persistence.MappedSuperclass; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.MappingException; import com.fr.third.org.hibernate.annotations.common.reflection.ClassLoadingException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackRegistryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackRegistryImpl.java index e6497abf2..7d729a223 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackRegistryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/CallbackRegistryImpl.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.event.internal.jpa; import java.util.HashMap; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.jpa.event.spi.jpa.Callback; import com.fr.third.org.hibernate.jpa.event.spi.jpa.CallbackRegistry; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/ListenerFactoryStandardImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/ListenerFactoryStandardImpl.java index e3e2e712d..9d1cdcfda 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/ListenerFactoryStandardImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/internal/jpa/ListenerFactoryStandardImpl.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.event.internal.jpa; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.jpa.event.spi.jpa.Listener; import com.fr.third.org.hibernate.jpa.event.spi.jpa.ListenerFactory; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/CallbackType.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/CallbackType.java index 7d7f02d67..5238c2f75 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/CallbackType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/CallbackType.java @@ -7,13 +7,13 @@ package com.fr.third.org.hibernate.jpa.event.spi.jpa; import java.lang.annotation.Annotation; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; +import com.fr.third.javax.persistence.PostLoad; +import com.fr.third.javax.persistence.PostPersist; +import com.fr.third.javax.persistence.PostRemove; +import com.fr.third.javax.persistence.PostUpdate; +import com.fr.third.javax.persistence.PrePersist; +import com.fr.third.javax.persistence.PreRemove; +import com.fr.third.javax.persistence.PreUpdate; /** * @author Steve Ebersole diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/Listener.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/Listener.java index 1e064edc2..4352d7eec 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/Listener.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/Listener.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.jpa.event.spi.jpa; /** * Encapsulates access to the listener instance for listener callbacks - * ({@link javax.persistence.EntityListeners}). + * ({@link com.fr.third.javax.persistence.EntityListeners}). * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/ListenerFactory.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/ListenerFactory.java index 7f967e458..787d3fed0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/ListenerFactory.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/event/spi/jpa/ListenerFactory.java @@ -12,7 +12,7 @@ package com.fr.third.org.hibernate.jpa.event.spi.jpa; * Listener instances should be uniqued by Class such that the same instance is * returned for any calls to {@link #buildListener} with the same class. * - * @see javax.persistence.EntityListeners + * @see com.fr.third.javax.persistence.EntityListeners * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AbstractGraphNode.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AbstractGraphNode.java index 19b2a7a91..48529c4d4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AbstractGraphNode.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AbstractGraphNode.java @@ -12,9 +12,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.AttributeNode; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.graph.spi.AttributeNodeImplementor; import com.fr.third.org.hibernate.graph.spi.GraphNodeImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AttributeNodeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AttributeNodeImpl.java index d990650b9..c2e21a35a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AttributeNodeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/AttributeNodeImpl.java @@ -9,11 +9,11 @@ package com.fr.third.org.hibernate.jpa.graph.internal; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import javax.persistence.AttributeNode; -import javax.persistence.Subgraph; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.Subgraph; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.graph.spi.AttributeNodeImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/EntityGraphImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/EntityGraphImpl.java index 9adcbb9dc..b3749953f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/EntityGraphImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/EntityGraphImpl.java @@ -7,13 +7,13 @@ package com.fr.third.org.hibernate.jpa.graph.internal; import java.util.List; -import javax.persistence.AttributeNode; -import javax.persistence.EntityGraph; -import javax.persistence.Subgraph; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.Subgraph; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.cfg.NotYetImplementedException; import com.fr.third.org.hibernate.graph.spi.GraphNodeImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/SubgraphImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/SubgraphImpl.java index 16be6fde2..4cca4c353 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/SubgraphImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/internal/SubgraphImpl.java @@ -7,10 +7,10 @@ package com.fr.third.org.hibernate.jpa.graph.internal; import java.util.List; -import javax.persistence.AttributeNode; -import javax.persistence.Subgraph; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.Subgraph; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.graph.spi.GraphNodeImplementor; import com.fr.third.org.hibernate.jpa.internal.EntityManagerFactoryImpl; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/package-info.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/package-info.java index b715731f5..aa82ec400 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/package-info.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/graph/package-info.java @@ -6,7 +6,7 @@ */ /** - * Definition of the Hibernate support for the JPA {@link javax.persistence.EntityGraph} feature-set + * Definition of the Hibernate support for the JPA {@link com.fr.third.javax.persistence.EntityGraph} feature-set * introduced in JPA 2.1 */ package com.fr.third.org.hibernate.jpa.graph; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java index e635c34d4..260720740 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java @@ -17,24 +17,24 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.Cache; -import javax.persistence.EntityGraph; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NamedAttributeNode; -import javax.persistence.NamedEntityGraph; -import javax.persistence.NamedSubgraph; -import javax.persistence.PersistenceContextType; -import javax.persistence.PersistenceException; -import javax.persistence.PersistenceUnitUtil; -import javax.persistence.Query; -import javax.persistence.SynchronizationType; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.Metamodel; -import javax.persistence.spi.LoadState; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.Cache; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.EntityManager; +import com.fr.third.javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.NamedAttributeNode; +import com.fr.third.javax.persistence.NamedEntityGraph; +import com.fr.third.javax.persistence.NamedSubgraph; +import com.fr.third.javax.persistence.PersistenceContextType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceUnitUtil; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.SynchronizationType; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.Metamodel; +import com.fr.third.javax.persistence.spi.LoadState; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.Hibernate; import com.fr.third.org.hibernate.MappingException; @@ -73,7 +73,7 @@ import com.fr.third.org.hibernate.proxy.HibernateProxy; import com.fr.third.org.jboss.logging.Logger; /** - * Actual Hibernate implementation of {@link javax.persistence.EntityManagerFactory}. + * Actual Hibernate implementation of {@link com.fr.third.javax.persistence.EntityManagerFactory}. * * @author Gavin King * @author Emmanuel Bernard @@ -682,13 +682,13 @@ public class EntityManagerFactoryImpl implements HibernateEntityManagerFactory { } else { // HHH-11426 - best effort to deal with the case of detached entities - log.debug( "javax.persistence.PersistenceUnitUtil.getIdentifier may not be able to read identifier of a detached entity" ); + log.debug( "com.fr.third.javax.persistence.PersistenceUnitUtil.getIdentifier may not be able to read identifier of a detached entity" ); return getIdentifierFromPersister( entity ); } } else { log.debugf( - "javax.persistence.PersistenceUnitUtil.getIdentifier is only intended to work with enhanced entities " + + "com.fr.third.javax.persistence.PersistenceUnitUtil.getIdentifier is only intended to work with enhanced entities " + "(although Hibernate also adapts this support to its proxies); " + "however the passed entity was not enhanced (nor a proxy).. may not be able to read identifier" ); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryRegistry.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryRegistry.java index bded8b142..ff4aa69da 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryRegistry.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerFactoryRegistry.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.jpa.internal; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.EntityManagerFactory; +import com.fr.third.javax.persistence.EntityManagerFactory; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.ejb.AvailableSettings; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerImpl.java index df2eeb83d..7d3162a1b 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerImpl.java @@ -8,11 +8,11 @@ package com.fr.third.org.hibernate.jpa.internal; import java.util.List; import java.util.Map; -import javax.persistence.EntityGraph; -import javax.persistence.PersistenceContextType; -import javax.persistence.PersistenceException; -import javax.persistence.SynchronizationType; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.PersistenceContextType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.SynchronizationType; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import javax.transaction.SystemException; import com.fr.third.org.hibernate.FlushMode; @@ -35,7 +35,7 @@ import com.fr.third.org.hibernate.resource.transaction.backend.jta.internal.sync import static com.fr.third.org.hibernate.jpa.internal.HEMLogging.messageLogger; /** - * Hibernate implementation of {@link javax.persistence.EntityManager}. + * Hibernate implementation of {@link com.fr.third.javax.persistence.EntityManager}. * * @author Gavin King */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerMessageLogger.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerMessageLogger.java index dbcdcd8e6..872f8a33b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerMessageLogger.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/EntityManagerMessageLogger.java @@ -11,10 +11,10 @@ import java.net.URL; import com.fr.third.org.hibernate.internal.CoreMessageLogger; -import org.jboss.logging.annotations.Cause; -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; +import com.fr.third.org.jboss.logging.annotations.Cause; +import com.fr.third.org.jboss.logging.annotations.LogMessage; +import com.fr.third.org.jboss.logging.annotations.Message; +import com.fr.third.org.jboss.logging.annotations.MessageLogger; import static com.fr.third.org.jboss.logging.Logger.Level.DEBUG; import static com.fr.third.org.jboss.logging.Logger.Level.ERROR; @@ -116,7 +116,7 @@ public interface EntityManagerMessageLogger extends CoreMessageLogger { @LogMessage(level = WARN) @Message( id = 15016, - value = "Encountered a deprecated javax.persistence.spi.PersistenceProvider [%s]; use [%s] instead." + value = "Encountered a deprecated com.fr.third.javax.persistence.spi.PersistenceProvider [%s]; use [%s] instead." ) void deprecatedPersistenceProvider(String deprecated, String replacement); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/QueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/QueryImpl.java index f5de59bf0..08a4e2e2f 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/QueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/QueryImpl.java @@ -14,13 +14,13 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.NoResultException; -import javax.persistence.NonUniqueResultException; -import javax.persistence.ParameterMode; -import javax.persistence.PersistenceException; -import javax.persistence.Query; -import javax.persistence.TemporalType; -import javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.NoResultException; +import com.fr.third.javax.persistence.NonUniqueResultException; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TypedQuery; import com.fr.third.org.hibernate.CacheMode; import com.fr.third.org.hibernate.FlushMode; @@ -46,9 +46,9 @@ import com.fr.third.org.hibernate.jpa.spi.ParameterBind; import com.fr.third.org.hibernate.type.CompositeCustomType; import com.fr.third.org.hibernate.type.Type; -import static javax.persistence.TemporalType.DATE; -import static javax.persistence.TemporalType.TIME; -import static javax.persistence.TemporalType.TIMESTAMP; +import static com.fr.third.javax.persistence.TemporalType.DATE; +import static com.fr.third.javax.persistence.TemporalType.TIME; +import static com.fr.third.javax.persistence.TemporalType.TIMESTAMP; import static com.fr.third.org.hibernate.jpa.internal.HEMLogging.messageLogger; /** @@ -585,7 +585,7 @@ public class QueryImpl extends AbstractQueryImpl } @Override - protected void internalApplyLockMode(javax.persistence.LockModeType lockModeType) { + protected void internalApplyLockMode(com.fr.third.javax.persistence.LockModeType lockModeType) { query.getLockOptions().setLockMode( LockModeTypeHelper.getLockMode( lockModeType ) ); if ( getHints() != null && getHints().containsKey( AvailableSettings.LOCK_TIMEOUT ) ) { applyLockTimeoutHint( ConfigurationHelper.getInteger( getHints().get( AvailableSettings.LOCK_TIMEOUT ) ) ); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/StoredProcedureQueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/StoredProcedureQueryImpl.java index b9f8fa098..6a52ce2c6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/StoredProcedureQueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/StoredProcedureQueryImpl.java @@ -9,17 +9,17 @@ package com.fr.third.org.hibernate.jpa.internal; import java.util.Calendar; import java.util.Date; import java.util.List; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.NoResultException; -import javax.persistence.NonUniqueResultException; -import javax.persistence.Parameter; -import javax.persistence.ParameterMode; -import javax.persistence.PersistenceException; -import javax.persistence.Query; -import javax.persistence.StoredProcedureQuery; -import javax.persistence.TemporalType; -import javax.persistence.TransactionRequiredException; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.NoResultException; +import com.fr.third.javax.persistence.NonUniqueResultException; +import com.fr.third.javax.persistence.Parameter; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.StoredProcedureQuery; +import com.fr.third.javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TransactionRequiredException; import com.fr.third.org.hibernate.CacheMode; import com.fr.third.org.hibernate.FlushMode; @@ -245,7 +245,7 @@ public class StoredProcedureQueryImpl extends BaseQueryImpl implements StoredPro @Override public int executeUpdate() { if ( ! entityManager().isTransactionInProgress() ) { - throw new TransactionRequiredException( "javax.persistence.Query.executeUpdate requires active transaction" ); + throw new TransactionRequiredException( "com.fr.third.javax.persistence.Query.executeUpdate requires active transaction" ); } // the expectation is that there is just one Output, of type UpdateCountOutput @@ -403,12 +403,12 @@ public class StoredProcedureQueryImpl extends BaseQueryImpl implements StoredPro @Override public Query setLockMode(LockModeType lockMode) { - throw new IllegalStateException( "javax.persistence.Query.setLockMode not valid on javax.persistence.StoredProcedureQuery" ); + throw new IllegalStateException( "com.fr.third.javax.persistence.Query.setLockMode not valid on com.fr.third.javax.persistence.StoredProcedureQuery" ); } @Override public LockModeType getLockMode() { - throw new IllegalStateException( "javax.persistence.Query.getLockMode not valid on javax.persistence.StoredProcedureQuery" ); + throw new IllegalStateException( "com.fr.third.javax.persistence.Query.getLockMode not valid on com.fr.third.javax.persistence.StoredProcedureQuery" ); } @@ -417,7 +417,7 @@ public class StoredProcedureQueryImpl extends BaseQueryImpl implements StoredPro @Override protected void internalApplyLockMode(LockModeType lockModeType) { - throw new IllegalStateException( "Specifying LockMode not valid on javax.persistence.StoredProcedureQuery" ); + throw new IllegalStateException( "Specifying LockMode not valid on com.fr.third.javax.persistence.StoredProcedureQuery" ); } @Override diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/TransactionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/TransactionImpl.java index 4a02a0d46..872bfc3d5 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/TransactionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/TransactionImpl.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.internal; -import javax.persistence.EntityTransaction; -import javax.persistence.PersistenceException; -import javax.persistence.RollbackException; +import com.fr.third.javax.persistence.EntityTransaction; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.RollbackException; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.Session; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractAttribute.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractAttribute.java index cff091f38..38bb154e6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractAttribute.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractAttribute.java @@ -12,8 +12,8 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.reflect.Member; import java.lang.reflect.Method; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.internal.util.ReflectHelper; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractIdentifiableType.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractIdentifiableType.java index 6533b8016..b59d10500 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractIdentifiableType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractIdentifiableType.java @@ -9,10 +9,10 @@ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; import java.util.HashSet; import java.util.Set; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; /** * Defines commonality for the JPA {@link IdentifiableType} types. JPA defines diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractManagedType.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractManagedType.java index 714a347f4..bbd791cdc 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractManagedType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractManagedType.java @@ -11,15 +11,15 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.Bindable; -import javax.persistence.metamodel.CollectionAttribute; -import javax.persistence.metamodel.ListAttribute; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SetAttribute; -import javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SetAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; import com.fr.third.org.hibernate.annotations.common.AssertionFailure; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractType.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractType.java index 8843aae8f..110ada10b 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AbstractType.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.Type; /** * Defines commonality for the JPA {@link Type} hierarchy of interfaces. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeFactory.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeFactory.java index 1418cfc7e..c4eaa70cb 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeFactory.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeFactory.java @@ -12,11 +12,11 @@ import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.TypeVariable; import java.util.Iterator; -import javax.persistence.ManyToMany; -import javax.persistence.OneToOne; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.ManyToMany; +import com.fr.third.javax.persistence.OneToOne; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.annotations.common.AssertionFailure; import com.fr.third.org.hibernate.jpa.internal.EntityManagerMessageLogger; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeImplementor.java index 7de60273a..91986808c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/AttributeImplementor.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package com.fr.third.org.hibernate.jpa.internal.metamodel; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.Attribute; /** * TODO : javadoc diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/BasicTypeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/BasicTypeImpl.java index 232f6ac5b..33e9bbd6f 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/BasicTypeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/BasicTypeImpl.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; -import javax.persistence.metamodel.BasicType; +import com.fr.third.javax.persistence.metamodel.BasicType; /** * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EmbeddableTypeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EmbeddableTypeImpl.java index b1d613386..8a65e0663 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EmbeddableTypeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EmbeddableTypeImpl.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; -import javax.persistence.metamodel.EmbeddableType; +import com.fr.third.javax.persistence.metamodel.EmbeddableType; import com.fr.third.org.hibernate.type.ComponentType; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EntityTypeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EntityTypeImpl.java index 71651836b..37c34657a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EntityTypeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/EntityTypeImpl.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; -import javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.EntityType; import com.fr.third.org.hibernate.mapping.PersistentClass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/Helper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/Helper.java index d9c3306a5..99d8c63c2 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/Helper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/Helper.java @@ -6,9 +6,9 @@ */ package com.fr.third.org.hibernate.jpa.internal.metamodel; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.ManagedType; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.persister.entity.EntityPersister; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MappedSuperclassTypeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MappedSuperclassTypeImpl.java index a956f6988..b872a85c7 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MappedSuperclassTypeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MappedSuperclassTypeImpl.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.internal.metamodel; -import javax.persistence.metamodel.MappedSuperclassType; +import com.fr.third.javax.persistence.metamodel.MappedSuperclassType; import com.fr.third.org.hibernate.mapping.MappedSuperclass; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetadataContext.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetadataContext.java index 6f59ee132..f6c78a0dc 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetadataContext.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetadataContext.java @@ -15,11 +15,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.MappedSuperclassType; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.metamodel.IdentifiableType; +import com.fr.third.javax.persistence.metamodel.MappedSuperclassType; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.annotations.common.AssertionFailure; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetamodelImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetamodelImpl.java index 52b753baa..7392320db 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetamodelImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/MetamodelImpl.java @@ -12,11 +12,11 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; -import javax.persistence.metamodel.EmbeddableType; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MappedSuperclassType; -import javax.persistence.metamodel.Metamodel; +import com.fr.third.javax.persistence.metamodel.EmbeddableType; +import com.fr.third.javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.ManagedType; +import com.fr.third.javax.persistence.metamodel.MappedSuperclassType; +import com.fr.third.javax.persistence.metamodel.Metamodel; import com.fr.third.org.hibernate.engine.spi.SessionFactoryImplementor; import com.fr.third.org.hibernate.internal.util.collections.CollectionHelper; @@ -173,7 +173,7 @@ public class MetamodelImpl implements Metamodel, Serializable { * * @param entities The entity mappings. * @param embeddables The embeddable (component) mappings. - * @param mappedSuperclassTypeMap The {@link javax.persistence.MappedSuperclass} mappings + * @param mappedSuperclassTypeMap The {@link com.fr.third.javax.persistence.MappedSuperclass} mappings */ private MetamodelImpl( Map, EntityTypeImpl> entities, diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/PluralAttributeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/PluralAttributeImpl.java index e5787c42b..ab0454cd8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/PluralAttributeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/PluralAttributeImpl.java @@ -12,12 +12,12 @@ import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.metamodel.CollectionAttribute; -import javax.persistence.metamodel.ListAttribute; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SetAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SetAttribute; +import com.fr.third.javax.persistence.metamodel.Type; import com.fr.third.org.hibernate.mapping.Property; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/SingularAttributeImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/SingularAttributeImpl.java index 8ce664d27..66068da1c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/SingularAttributeImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/metamodel/SingularAttributeImpl.java @@ -8,8 +8,8 @@ package com.fr.third.org.hibernate.jpa.internal.metamodel; import java.io.Serializable; import java.lang.reflect.Member; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import com.fr.third.javax.persistence.metamodel.Type; /** * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/CacheModeHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/CacheModeHelper.java index f8f3d0cf2..72150877d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/CacheModeHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/CacheModeHelper.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.jpa.internal.util; -import javax.persistence.CacheRetrieveMode; -import javax.persistence.CacheStoreMode; +import com.fr.third.javax.persistence.CacheRetrieveMode; +import com.fr.third.javax.persistence.CacheStoreMode; import com.fr.third.org.hibernate.CacheMode; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/ConfigurationHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/ConfigurationHelper.java index b62b10d71..a6e56501d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/ConfigurationHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/ConfigurationHelper.java @@ -9,8 +9,8 @@ package com.fr.third.org.hibernate.jpa.internal.util; import java.util.Locale; import java.util.Map; import java.util.Properties; -import javax.persistence.FlushModeType; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.CacheMode; @@ -33,8 +33,8 @@ public abstract class ConfigurationHelper { if (value instanceof FlushMode) { flushMode = (FlushMode) value; } - else if (value instanceof javax.persistence.FlushModeType) { - flushMode = ConfigurationHelper.getFlushMode( (javax.persistence.FlushModeType) value); + else if (value instanceof com.fr.third.javax.persistence.FlushModeType) { + flushMode = ConfigurationHelper.getFlushMode( (com.fr.third.javax.persistence.FlushModeType) value); } else if (value instanceof String) { flushMode = ConfigurationHelper.getFlushMode( (String) value); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/LockModeTypeHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/LockModeTypeHelper.java index 694dc185b..8477da8d4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/LockModeTypeHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/LockModeTypeHelper.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.internal.util; -import javax.persistence.LockModeType; +import com.fr.third.javax.persistence.LockModeType; import com.fr.third.org.hibernate.LockMode; import com.fr.third.org.hibernate.internal.util.LockModeConverter; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUnitTransactionTypeHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUnitTransactionTypeHelper.java index dea3add15..dcf859c35 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUnitTransactionTypeHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUnitTransactionTypeHelper.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.jpa.internal.util; -import javax.persistence.PersistenceException; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import com.fr.third.org.hibernate.internal.util.StringHelper; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUtilHelper.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUtilHelper.java index 4a7975475..c88d98bc2 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUtilHelper.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/internal/util/PersistenceUtilHelper.java @@ -17,7 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; -import javax.persistence.spi.LoadState; +import com.fr.third.javax.persistence.spi.LoadState; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor; @@ -28,11 +28,11 @@ import com.fr.third.org.hibernate.proxy.LazyInitializer; /** * Central delegate for handling calls from:

      - *
    • {@link javax.persistence.PersistenceUtil#isLoaded(Object)}
    • - *
    • {@link javax.persistence.PersistenceUtil#isLoaded(Object, String)}
    • - *
    • {@link javax.persistence.spi.ProviderUtil#isLoaded(Object)}
    • - *
    • {@link javax.persistence.spi.ProviderUtil#isLoadedWithReference(Object, String)}
    • - *
    • {@link javax.persistence.spi.ProviderUtil#isLoadedWithoutReference(Object, String)}li> + *
    • {@link com.fr.third.javax.persistence.PersistenceUtil#isLoaded(Object)}
    • + *
    • {@link com.fr.third.javax.persistence.PersistenceUtil#isLoaded(Object, String)}
    • + *
    • {@link com.fr.third.javax.persistence.spi.ProviderUtil#isLoaded(Object)}
    • + *
    • {@link com.fr.third.javax.persistence.spi.ProviderUtil#isLoadedWithReference(Object, String)}
    • + *
    • {@link com.fr.third.javax.persistence.spi.ProviderUtil#isLoadedWithoutReference(Object, String)}li> *
    * * @author Emmanuel Bernard diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java index b9be4a07c..13cb7dbd7 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java @@ -15,38 +15,38 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.CacheRetrieveMode; -import javax.persistence.CacheStoreMode; -import javax.persistence.EntityExistsException; -import javax.persistence.EntityGraph; -import javax.persistence.EntityManager; -import javax.persistence.EntityNotFoundException; -import javax.persistence.EntityTransaction; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.LockTimeoutException; -import javax.persistence.NoResultException; -import javax.persistence.NonUniqueResultException; -import javax.persistence.OptimisticLockException; -import javax.persistence.PersistenceContextType; -import javax.persistence.PersistenceException; -import javax.persistence.PessimisticLockException; -import javax.persistence.PessimisticLockScope; -import javax.persistence.Query; -import javax.persistence.QueryTimeoutException; -import javax.persistence.StoredProcedureQuery; -import javax.persistence.SynchronizationType; -import javax.persistence.TransactionRequiredException; -import javax.persistence.Tuple; -import javax.persistence.TupleElement; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaDelete; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.CriteriaUpdate; -import javax.persistence.criteria.Selection; -import javax.persistence.metamodel.Metamodel; -import javax.persistence.spi.PersistenceUnitTransactionType; +import com.fr.third.javax.persistence.CacheRetrieveMode; +import com.fr.third.javax.persistence.CacheStoreMode; +import com.fr.third.javax.persistence.EntityExistsException; +import com.fr.third.javax.persistence.EntityGraph; +import com.fr.third.javax.persistence.EntityManager; +import com.fr.third.javax.persistence.EntityNotFoundException; +import com.fr.third.javax.persistence.EntityTransaction; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.LockTimeoutException; +import com.fr.third.javax.persistence.NoResultException; +import com.fr.third.javax.persistence.NonUniqueResultException; +import com.fr.third.javax.persistence.OptimisticLockException; +import com.fr.third.javax.persistence.PersistenceContextType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PessimisticLockException; +import com.fr.third.javax.persistence.PessimisticLockScope; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.QueryTimeoutException; +import com.fr.third.javax.persistence.StoredProcedureQuery; +import com.fr.third.javax.persistence.SynchronizationType; +import com.fr.third.javax.persistence.TransactionRequiredException; +import com.fr.third.javax.persistence.Tuple; +import com.fr.third.javax.persistence.TupleElement; +import com.fr.third.javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.criteria.CriteriaBuilder; +import com.fr.third.javax.persistence.criteria.CriteriaDelete; +import com.fr.third.javax.persistence.criteria.CriteriaQuery; +import com.fr.third.javax.persistence.criteria.CriteriaUpdate; +import com.fr.third.javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.metamodel.Metamodel; +import com.fr.third.javax.persistence.spi.PersistenceUnitTransactionType; import javax.transaction.Status; import javax.transaction.SystemException; import javax.transaction.TransactionManager; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractQueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractQueryImpl.java index e6caa326c..03741acc4 100755 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractQueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/AbstractQueryImpl.java @@ -9,12 +9,12 @@ package com.fr.third.org.hibernate.jpa.spi; import java.util.Calendar; import java.util.Date; import java.util.Set; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.Parameter; -import javax.persistence.TemporalType; -import javax.persistence.TransactionRequiredException; -import javax.persistence.TypedQuery; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.Parameter; +import com.fr.third.javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TransactionRequiredException; +import com.fr.third.javax.persistence.TypedQuery; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.TypeMismatchException; @@ -22,10 +22,10 @@ import com.fr.third.org.hibernate.hql.internal.QueryExecutionRequestException; import com.fr.third.org.hibernate.jpa.QueryHints; /** - * Base class for implementing both {@link javax.persistence.Query} and {@link javax.persistence.TypedQuery}, including + * Base class for implementing both {@link com.fr.third.javax.persistence.Query} and {@link com.fr.third.javax.persistence.TypedQuery}, including * query references built from criteria queries. *

    - * Not intended as base for {@link javax.persistence.StoredProcedureQuery} + * Not intended as base for {@link com.fr.third.javax.persistence.StoredProcedureQuery} * * @author Steve Ebersole */ @@ -96,11 +96,11 @@ public abstract class AbstractQueryImpl extends BaseQueryImpl implements Type return QueryHints.getDefinedHints(); } - private javax.persistence.LockModeType jpaLockMode = javax.persistence.LockModeType.NONE; + private com.fr.third.javax.persistence.LockModeType jpaLockMode = com.fr.third.javax.persistence.LockModeType.NONE; @Override @SuppressWarnings({ "unchecked" }) - public TypedQuery setLockMode(javax.persistence.LockModeType lockModeType) { + public TypedQuery setLockMode(com.fr.third.javax.persistence.LockModeType lockModeType) { checkOpen( true ); if ( isNativeSqlQuery() ) { @@ -122,7 +122,7 @@ public abstract class AbstractQueryImpl extends BaseQueryImpl implements Type } @Override - public javax.persistence.LockModeType getLockMode() { + public com.fr.third.javax.persistence.LockModeType getLockMode() { checkOpen( false ); if ( isNativeSqlQuery() ) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/BaseQueryImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/BaseQueryImpl.java index 518034a04..594652f53 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/BaseQueryImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/BaseQueryImpl.java @@ -13,13 +13,13 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.persistence.CacheRetrieveMode; -import javax.persistence.CacheStoreMode; -import javax.persistence.FlushModeType; -import javax.persistence.LockModeType; -import javax.persistence.Parameter; -import javax.persistence.Query; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.CacheRetrieveMode; +import com.fr.third.javax.persistence.CacheStoreMode; +import com.fr.third.javax.persistence.FlushModeType; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.Parameter; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.TemporalType; import com.fr.third.org.hibernate.CacheMode; import com.fr.third.org.hibernate.FlushMode; @@ -55,8 +55,8 @@ import static com.fr.third.org.hibernate.jpa.QueryHints.HINT_TIMEOUT; import static com.fr.third.org.hibernate.jpa.QueryHints.SPEC_HINT_TIMEOUT; /** - * Intended as the base class for all {@link javax.persistence.Query} implementations, including - * {@link javax.persistence.TypedQuery} and {@link javax.persistence.StoredProcedureQuery}. Care should be taken + * Intended as the base class for all {@link com.fr.third.javax.persistence.Query} implementations, including + * {@link com.fr.third.javax.persistence.TypedQuery} and {@link com.fr.third.javax.persistence.StoredProcedureQuery}. Care should be taken * that all changes here fit with all those usages. * * @author Steve Ebersole @@ -405,7 +405,7 @@ public abstract class BaseQueryImpl implements Query { */ protected abstract boolean isSelectQuery(); - protected abstract void internalApplyLockMode(javax.persistence.LockModeType lockModeType); + protected abstract void internalApplyLockMode(com.fr.third.javax.persistence.LockModeType lockModeType); // FlushMode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -563,7 +563,7 @@ public abstract class BaseQueryImpl implements Query { ( (NullTypeBindableParameterRegistration) parameterRegistrationExisting ).bindNullValue( param.getParameterType() ); } else { - // NOTE: The Javadoc for javax.persistence.Query#setParameter(Parameter param, T value) + // NOTE: The Javadoc for com.fr.third.javax.persistence.Query#setParameter(Parameter param, T value) // does not say anything about throwing IllegalArgumentException if // javax.persistenceParameter#getParameterType is not assignable to the type, so we simply log // a message if this is the case. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java index 0c0679a70..696e5c9e6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java @@ -8,9 +8,9 @@ package com.fr.third.org.hibernate.jpa.spi; import java.util.List; import java.util.Map; -import javax.persistence.LockModeType; -import javax.persistence.PersistenceException; -import javax.persistence.criteria.Selection; +import com.fr.third.javax.persistence.LockModeType; +import com.fr.third.javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.criteria.Selection; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.LockOptions; @@ -21,7 +21,7 @@ import com.fr.third.org.hibernate.jpa.internal.QueryImpl; import com.fr.third.org.hibernate.type.Type; /** - * Additional internal contracts for the Hibernate {@link javax.persistence.EntityManager} implementation. + * Additional internal contracts for the Hibernate {@link com.fr.third.javax.persistence.EntityManager} implementation. * * @author Emmanuel Bernard * @author Steve Ebersole @@ -104,7 +104,7 @@ public interface HibernateEntityManagerImplementor extends HibernateEntityManage public PersistenceException wrapStaleStateException(StaleStateException e); /** - * Convert from JPA 2 {@link javax.persistence.LockModeType} & properties into {@link com.fr.third.org.hibernate.LockOptions} + * Convert from JPA 2 {@link com.fr.third.javax.persistence.LockModeType} & properties into {@link com.fr.third.org.hibernate.LockOptions} * * @param lockModeType is the requested lock type * @param properties are the lock properties diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterBind.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterBind.java index 3413e2aed..d51cdb0b3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterBind.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterBind.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.jpa.spi; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TemporalType; /** * Represents the value currently bound to a particular (bindable) parameter. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterRegistration.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterRegistration.java index aa8682355..e238d80b7 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterRegistration.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpa/spi/ParameterRegistration.java @@ -6,14 +6,14 @@ */ package com.fr.third.org.hibernate.jpa.spi; -import javax.persistence.Parameter; -import javax.persistence.ParameterMode; -import javax.persistence.Query; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.Parameter; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.Query; +import com.fr.third.javax.persistence.TemporalType; /** - * Hibernate specific extension to the JPA {@link javax.persistence.Parameter} contract as known to the - * {@link javax.persistence.Query} and {@link javax.persistence.StoredProcedureQuery} implementations. Used to track + * Hibernate specific extension to the JPA {@link com.fr.third.javax.persistence.Parameter} contract as known to the + * {@link com.fr.third.javax.persistence.Query} and {@link com.fr.third.javax.persistence.StoredProcedureQuery} implementations. Used to track * information known about the parameter. *

    * For parameter information as known to JPA criteria queries, see {@link com.fr.third.org.hibernate.jpa.criteria.expression.ParameterExpressionImpl} diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/ClassWriter.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/ClassWriter.java index 531f771cd..b41f43198 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/ClassWriter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/ClassWriter.java @@ -214,6 +214,6 @@ public final class ClassWriter { } private static String writeStaticMetaModelAnnotation(MetaEntity entity) { - return "@" + entity.importType( "javax.persistence.metamodel.StaticMetamodel" ) + "(" + entity.getSimpleName() + ".class)"; + return "@" + entity.importType( "com.fr.third.javax.persistence.metamodel.StaticMetamodel" ) + "(" + entity.getSimpleName() + ".class)"; } } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java index b94a50daa..7974bcd5c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/JPAMetaModelEntityProcessor.java @@ -43,7 +43,7 @@ import com.fr.third.org.hibernate.jpamodelgen.xml.JpaDescriptorParser; * @author Emmanuel Bernard */ @SupportedAnnotationTypes({ - "javax.persistence.Entity", "javax.persistence.MappedSuperclass", "javax.persistence.Embeddable" + "com.fr.third.javax.persistence.Entity", "com.fr.third.javax.persistence.MappedSuperclass", "com.fr.third.javax.persistence.Embeddable" }) @SupportedOptions({ JPAMetaModelEntityProcessor.DEBUG_OPTION, diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/AnnotationMetaSingleAttribute.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/AnnotationMetaSingleAttribute.java index d47582055..1859c7f77 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/AnnotationMetaSingleAttribute.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/AnnotationMetaSingleAttribute.java @@ -23,6 +23,6 @@ public class AnnotationMetaSingleAttribute extends AnnotationMetaAttribute imple @Override public final String getMetaType() { - return "javax.persistence.metamodel.SingularAttribute"; + return "com.fr.third.javax.persistence.metamodel.SingularAttribute"; } } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java index 0876d7001..8b195e755 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/annotation/MetaAttributeGenerationVisitor.java @@ -139,7 +139,7 @@ public class MetaAttributeGenerationVisitor extends SimpleTypeVisitor6 COLLECTIONS = new HashMap(); static { - COLLECTIONS.put( java.util.Collection.class.getName(), "javax.persistence.metamodel.CollectionAttribute" ); - COLLECTIONS.put( java.util.Set.class.getName(), "javax.persistence.metamodel.SetAttribute" ); - COLLECTIONS.put( java.util.List.class.getName(), "javax.persistence.metamodel.ListAttribute" ); - COLLECTIONS.put( java.util.Map.class.getName(), "javax.persistence.metamodel.MapAttribute" ); + COLLECTIONS.put( java.util.Collection.class.getName(), "com.fr.third.javax.persistence.metamodel.CollectionAttribute" ); + COLLECTIONS.put( java.util.Set.class.getName(), "com.fr.third.javax.persistence.metamodel.SetAttribute" ); + COLLECTIONS.put( java.util.List.class.getName(), "com.fr.third.javax.persistence.metamodel.ListAttribute" ); + COLLECTIONS.put( java.util.Map.class.getName(), "com.fr.third.javax.persistence.metamodel.MapAttribute" ); // Hibernate also supports the SortedSet and SortedMap interfaces - COLLECTIONS.put( java.util.SortedSet.class.getName(), "javax.persistence.metamodel.SetAttribute" ); - COLLECTIONS.put( java.util.SortedMap.class.getName(), "javax.persistence.metamodel.MapAttribute" ); + COLLECTIONS.put( java.util.SortedSet.class.getName(), "com.fr.third.javax.persistence.metamodel.SetAttribute" ); + COLLECTIONS.put( java.util.SortedMap.class.getName(), "com.fr.third.javax.persistence.metamodel.MapAttribute" ); } public static final List BASIC_TYPES = new ArrayList(); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java index 25d91755d..f65aeb5f5 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java @@ -54,10 +54,10 @@ public class XmlMetaEntity implements MetaEntity { static final Map COLLECTIONS = new HashMap(); static { - COLLECTIONS.put( "java.util.Collection", "javax.persistence.metamodel.CollectionAttribute" ); - COLLECTIONS.put( "java.util.Set", "javax.persistence.metamodel.SetAttribute" ); - COLLECTIONS.put( "java.util.List", "javax.persistence.metamodel.ListAttribute" ); - COLLECTIONS.put( "java.util.Map", "javax.persistence.metamodel.MapAttribute" ); + COLLECTIONS.put( "java.util.Collection", "com.fr.third.javax.persistence.metamodel.CollectionAttribute" ); + COLLECTIONS.put( "java.util.Set", "com.fr.third.javax.persistence.metamodel.SetAttribute" ); + COLLECTIONS.put( "java.util.List", "com.fr.third.javax.persistence.metamodel.ListAttribute" ); + COLLECTIONS.put( "java.util.Map", "com.fr.third.javax.persistence.metamodel.MapAttribute" ); } private final String clazzName; @@ -244,7 +244,7 @@ public class XmlMetaEntity implements MetaEntity { String[] types = new String[3]; determineTargetType( type, propertyName, explicitTargetEntity, types ); determineCollectionType( type, types ); - if ( types[1].equals( "javax.persistence.metamodel.MapAttribute" ) ) { + if ( types[1].equals( "com.fr.third.javax.persistence.metamodel.MapAttribute" ) ) { determineMapType( type, explicitMapKeyClass, types ); } return types; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaSingleAttribute.java b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaSingleAttribute.java index 78a85db88..4ab410bdb 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaSingleAttribute.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/jpamodelgen/xml/XmlMetaSingleAttribute.java @@ -19,6 +19,6 @@ public class XmlMetaSingleAttribute extends XmlMetaAttribute implements MetaSing @Override public String getMetaType() { - return "javax.persistence.metamodel.SingularAttribute"; + return "com.fr.third.javax.persistence.metamodel.SingularAttribute"; } } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorResultColumnProcessor.java b/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorResultColumnProcessor.java index 5e06c3e7b..a225da424 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorResultColumnProcessor.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorResultColumnProcessor.java @@ -19,7 +19,7 @@ import com.fr.third.org.hibernate.internal.util.type.PrimitiveWrapperHelper; import com.fr.third.org.hibernate.type.Type; /** - * Represents a {@link javax.persistence.ConstructorResult} within the custom query. + * Represents a {@link com.fr.third.javax.persistence.ConstructorResult} within the custom query. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorReturn.java b/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorReturn.java index 518b8a3bb..9c9be0ea2 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorReturn.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/loader/custom/ConstructorReturn.java @@ -7,7 +7,7 @@ package com.fr.third.org.hibernate.loader.custom; /** - * A return representing a {@link javax.persistence.ConstructorResult} + * A return representing a {@link com.fr.third.javax.persistence.ConstructorResult} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.java b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.java index b1067c602..39d829bbe 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.java @@ -11,9 +11,9 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.persistence.AttributeNode; -import javax.persistence.Subgraph; -import javax.persistence.metamodel.Attribute; +import com.fr.third.javax.persistence.AttributeNode; +import com.fr.third.javax.persistence.Subgraph; +import com.fr.third.javax.persistence.metamodel.Attribute; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.LockMode; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/FetchGraphLoadPlanBuildingStrategy.java b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/FetchGraphLoadPlanBuildingStrategy.java index b30bb0ac2..55320dcf0 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/FetchGraphLoadPlanBuildingStrategy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/FetchGraphLoadPlanBuildingStrategy.java @@ -14,7 +14,7 @@ import com.fr.third.org.hibernate.graph.spi.GraphNodeImplementor; import com.fr.third.org.hibernate.persister.walking.spi.AssociationAttributeDefinition; /** - * Loadplan building strategy for {@link javax.persistence.EntityGraph} is applied in {@code javax.persistence.fetchgraph} mode. + * Loadplan building strategy for {@link com.fr.third.javax.persistence.EntityGraph} is applied in {@code com.fr.third.javax.persistence.fetchgraph} mode. * * @author Strong Liu */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/LoadGraphLoadPlanBuildingStrategy.java b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/LoadGraphLoadPlanBuildingStrategy.java index 12d7b5f27..0cfa2628e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/LoadGraphLoadPlanBuildingStrategy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/loader/plan/build/internal/LoadGraphLoadPlanBuildingStrategy.java @@ -17,7 +17,7 @@ import com.fr.third.org.hibernate.graph.spi.GraphNodeImplementor; import com.fr.third.org.hibernate.persister.walking.spi.AssociationAttributeDefinition; /** - * Loadplan building strategy for {@link javax.persistence.EntityGraph} is applied in {@code javax.persistence.loadgraph} mode. + * Loadplan building strategy for {@link com.fr.third.javax.persistence.EntityGraph} is applied in {@code com.fr.third.javax.persistence.loadgraph} mode. * * @author Strong Liu */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/mapping/SimpleValue.java b/fine-hibernate/src/com/fr/third/org/hibernate/mapping/SimpleValue.java index 50dbc5dce..975c03c0b 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/mapping/SimpleValue.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/mapping/SimpleValue.java @@ -14,7 +14,7 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Properties; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.FetchMode; import com.fr.third.org.hibernate.MappingException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterBind.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterBind.java index 5a615acd7..3ae6f9119 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterBind.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterBind.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.procedure; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TemporalType; /** * Describes an input value binding for any IN/INOUT parameters. diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterRegistration.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterRegistration.java index 486975cd4..b06551ef3 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterRegistration.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ParameterRegistration.java @@ -6,8 +6,8 @@ */ package com.fr.third.org.hibernate.procedure; -import javax.persistence.ParameterMode; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.TemporalType; import com.fr.third.org.hibernate.type.Type; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureCall.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureCall.java index 2e817649b..e4541da06 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureCall.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureCall.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.procedure; import java.util.List; import java.util.Map; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.BasicQueryContract; import com.fr.third.org.hibernate.MappingException; @@ -49,7 +49,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery public ParameterRegistration registerParameter(int position, Class type, ParameterMode mode); /** - * Chained form of {@link #registerParameter(int, Class, javax.persistence.ParameterMode)} + * Chained form of {@link #registerParameter(int, Class, com.fr.third.javax.persistence.ParameterMode)} * * @param position The position * @param type The Java type of the parameter @@ -88,7 +88,7 @@ public interface ProcedureCall extends BasicQueryContract, SynchronizeableQuery throws NamedParametersNotSupportedException; /** - * Chained form of {@link #registerParameter(String, Class, javax.persistence.ParameterMode)} + * Chained form of {@link #registerParameter(String, Class, com.fr.third.javax.persistence.ParameterMode)} * * @param parameterName The parameter name * @param type The Java type of the parameter diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureOutputs.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureOutputs.java index bf3b5319d..f86512f73 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureOutputs.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/ProcedureOutputs.java @@ -25,7 +25,7 @@ public interface ProcedureOutputs extends Outputs { * * @return The output value. * - * @see ProcedureCall#registerParameter(String, Class, javax.persistence.ParameterMode) + * @see ProcedureCall#registerParameter(String, Class, com.fr.third.javax.persistence.ParameterMode) */ public T getOutputParameterValue(ParameterRegistration parameterRegistration); @@ -39,7 +39,7 @@ public interface ProcedureOutputs extends Outputs { * @throws ParameterStrategyException If the ProcedureCall is defined using positional parameters * @throws NoSuchParameterException If no parameter with that name exists * - * @see ProcedureCall#registerParameter(String, Class, javax.persistence.ParameterMode) + * @see ProcedureCall#registerParameter(String, Class, com.fr.third.javax.persistence.ParameterMode) */ public Object getOutputParameterValue(String name); @@ -53,7 +53,7 @@ public interface ProcedureOutputs extends Outputs { * @throws ParameterStrategyException If the ProcedureCall is defined using named parameters * @throws NoSuchParameterException If no parameter with that position exists * - * @see ProcedureCall#registerParameter(int, Class, javax.persistence.ParameterMode) + * @see ProcedureCall#registerParameter(int, Class, com.fr.third.javax.persistence.ParameterMode) */ public Object getOutputParameterValue(int position); } diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/AbstractParameterRegistrationImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/AbstractParameterRegistrationImpl.java index 1a83a840f..260874c87 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/AbstractParameterRegistrationImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/AbstractParameterRegistrationImpl.java @@ -10,8 +10,8 @@ import java.sql.CallableStatement; import java.sql.SQLException; import java.util.Calendar; import java.util.Date; -import javax.persistence.ParameterMode; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.TemporalType; import com.fr.third.org.hibernate.engine.jdbc.cursor.spi.RefCursorSupport; import com.fr.third.org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/NamedParameterRegistration.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/NamedParameterRegistration.java index a7a0eb12c..6db34b991 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/NamedParameterRegistration.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/NamedParameterRegistration.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.procedure.internal; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.type.Type; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ParameterBindImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ParameterBindImpl.java index 46219d8f1..0c5b91f05 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ParameterBindImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ParameterBindImpl.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.procedure.internal; -import javax.persistence.TemporalType; +import com.fr.third.javax.persistence.TemporalType; import com.fr.third.org.hibernate.procedure.ParameterBind; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PositionalParameterRegistration.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PositionalParameterRegistration.java index e126b2283..e05fd1a67 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PositionalParameterRegistration.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PositionalParameterRegistration.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.procedure.internal; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.type.Type; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PostgresCallableStatementSupport.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PostgresCallableStatementSupport.java index 61ba7cae6..363e6366d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PostgresCallableStatementSupport.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/PostgresCallableStatementSupport.java @@ -10,7 +10,7 @@ import java.sql.CallableStatement; import java.sql.SQLException; import java.sql.Types; import java.util.List; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.engine.spi.SessionImplementor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallImpl.java index 195769e2f..8babd811c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallImpl.java @@ -15,7 +15,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.HibernateException; import com.fr.third.org.hibernate.QueryException; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallMementoImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallMementoImpl.java index 62f3908ce..90390ff6c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallMementoImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/ProcedureCallMementoImpl.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.procedure.internal; import java.util.List; import java.util.Map; import java.util.Set; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.Session; import com.fr.third.org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/StandardCallableStatementSupport.java b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/StandardCallableStatementSupport.java index 07ce756af..911c25ec4 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/StandardCallableStatementSupport.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/procedure/internal/StandardCallableStatementSupport.java @@ -9,7 +9,7 @@ package com.fr.third.org.hibernate.procedure.internal; import java.sql.CallableStatement; import java.sql.SQLException; import java.util.List; -import javax.persistence.ParameterMode; +import com.fr.third.javax.persistence.ParameterMode; import com.fr.third.org.hibernate.QueryException; import com.fr.third.org.hibernate.dialect.Dialect; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/property/access/internal/PropertyAccessMixedImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/property/access/internal/PropertyAccessMixedImpl.java index d6d2283ad..2a6268881 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/property/access/internal/PropertyAccessMixedImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/property/access/internal/PropertyAccessMixedImpl.java @@ -10,8 +10,8 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; -import javax.persistence.Access; -import javax.persistence.AccessType; +import com.fr.third.javax.persistence.Access; +import com.fr.third.javax.persistence.AccessType; import com.fr.third.org.hibernate.PropertyNotFoundException; import com.fr.third.org.hibernate.internal.util.ReflectHelper; import com.fr.third.org.hibernate.property.access.spi.Getter; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/resource/transaction/TransactionCoordinator.java b/fine-hibernate/src/com/fr/third/org/hibernate/resource/transaction/TransactionCoordinator.java index c2fd5397a..0a4a3c607 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/resource/transaction/TransactionCoordinator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/resource/transaction/TransactionCoordinator.java @@ -18,7 +18,7 @@ import com.fr.third.org.hibernate.resource.transaction.spi.TransactionStatus; public interface TransactionCoordinator { /** * Indicates an explicit request to join a transaction. This is mainly intended to handle the JPA requirement - * around {@link javax.persistence.EntityManager#joinTransaction()}, and generally speaking only has an impact in + * around {@link com.fr.third.javax.persistence.EntityManager#joinTransaction()}, and generally speaking only has an impact in * JTA environments */ public void explicitJoin(); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java b/fine-hibernate/src/com/fr/third/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java index 616445bc7..887b6ed35 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java @@ -16,7 +16,7 @@ import com.fr.third.org.jboss.logging.Logger; /** * A translator for order-by mappings, whether specified by hbm.xml files, Hibernate - * {@link com.fr.third.org.hibernate.annotations.OrderBy} annotation or JPA {@link javax.persistence.OrderBy} annotation. + * {@link com.fr.third.org.hibernate.annotations.OrderBy} annotation or JPA {@link com.fr.third.javax.persistence.OrderBy} annotation. * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/JdbcMetadaAccessStrategy.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/JdbcMetadaAccessStrategy.java index fd129a1c1..9f28b78f2 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/JdbcMetadaAccessStrategy.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/JdbcMetadaAccessStrategy.java @@ -16,14 +16,14 @@ public enum JdbcMetadaAccessStrategy { /** * The {@link com.fr.third.org.hibernate.tool.schema.spi.SchemaMigrator} and {@link com.fr.third.org.hibernate.tool.schema.spi.SchemaValidator} * execute one {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call for each - * {@link javax.persistence.Entity} in order to determine if a corresponding database table exists. + * {@link com.fr.third.javax.persistence.Entity} in order to determine if a corresponding database table exists. */ INDIVIDUALLY( "individually" ), /** * The {@link com.fr.third.org.hibernate.tool.schema.spi.SchemaMigrator} and {@link com.fr.third.org.hibernate.tool.schema.spi.SchemaValidator} * execute a single {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call - * to retrieve all the database table in order to determine all the {@link javax.persistence.Entity} have a mapped database tables. + * to retrieve all the database table in order to determine all the {@link com.fr.third.javax.persistence.Entity} have a mapped database tables. */ GROUPED( "grouped" ); diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java index 4f95d4c50..14b07629a 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaMigratorImpl.java @@ -25,7 +25,7 @@ import com.fr.third.org.hibernate.tool.schema.spi.SchemaFilter; * @author Andrea Boriero * * This implementation executes a single {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call - * to retrieve all the database table in order to determine if all the {@link javax.persistence.Entity} have a mapped database tables. + * to retrieve all the database table in order to determine if all the {@link com.fr.third.javax.persistence.Entity} have a mapped database tables. */ public class GroupedSchemaMigratorImpl extends AbstractSchemaMigrator { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaValidatorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaValidatorImpl.java index 11bc05f9e..84eb53fc8 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaValidatorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/GroupedSchemaValidatorImpl.java @@ -19,7 +19,7 @@ import com.fr.third.org.hibernate.tool.schema.spi.SchemaFilter; * @author Andrea Boriero * * This implementation executes a single {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call - * to retrieve all the database table in order to determine if all the {@link javax.persistence.Entity} have a mapped database tables. + * to retrieve all the database table in order to determine if all the {@link com.fr.third.javax.persistence.Entity} have a mapped database tables. */ public class GroupedSchemaValidatorImpl extends AbstractSchemaValidator { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java index 1661a2aa1..716623bb6 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaMigratorImpl.java @@ -25,7 +25,7 @@ import com.fr.third.org.hibernate.tool.schema.spi.SchemaFilter; * @author Andrea Boriero * * This implementation executes one {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call - * for each {@link javax.persistence.Entity} in order to determine if a corresponding database table exists. + * for each {@link com.fr.third.javax.persistence.Entity} in order to determine if a corresponding database table exists. */ public class IndividuallySchemaMigratorImpl extends AbstractSchemaMigrator { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaValidatorImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaValidatorImpl.java index 77fab0413..151c22b1d 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaValidatorImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/IndividuallySchemaValidatorImpl.java @@ -19,7 +19,7 @@ import com.fr.third.org.hibernate.tool.schema.spi.SchemaFilter; * @author Andrea Boriero * * This implementation executes one {@link java.sql.DatabaseMetaData#getTables(String, String, String, String[])} call - * for each {@link javax.persistence.Entity} in order to determine if a corresponding database table exists. + * for each {@link com.fr.third.javax.persistence.Entity} in order to determine if a corresponding database table exists. */ public class IndividuallySchemaValidatorImpl extends AbstractSchemaValidator { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessConnectionProviderImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessConnectionProviderImpl.java index c80164ed3..272bf9e20 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessConnectionProviderImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessConnectionProviderImpl.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.tool.schema.internal.exec; import java.sql.Connection; import java.sql.SQLException; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import com.fr.third.org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessProvidedConnectionImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessProvidedConnectionImpl.java index e6d5efdce..be39f76c9 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessProvidedConnectionImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/tool/schema/internal/exec/JdbcConnectionAccessProvidedConnectionImpl.java @@ -8,7 +8,7 @@ package com.fr.third.org.hibernate.tool.schema.internal.exec; import java.sql.Connection; import java.sql.SQLException; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/CalendarTimeType.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/CalendarTimeType.java index 1b94fa158..e2d4e7d94 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/CalendarTimeType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/CalendarTimeType.java @@ -14,8 +14,8 @@ import com.fr.third.org.hibernate.type.descriptor.sql.TimeTypeDescriptor; /** * A type mapping {@link java.sql.Types#TIME TIME} and {@link Calendar}. *

    - * For example, a Calendar attribute annotated with {@link javax.persistence.Temporal} and specifying - * {@link javax.persistence.TemporalType#TIME} + * For example, a Calendar attribute annotated with {@link com.fr.third.javax.persistence.Temporal} and specifying + * {@link com.fr.third.javax.persistence.TemporalType#TIME} * * @author Steve Ebersole */ diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/EnumType.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/EnumType.java index 142c42a14..2d3a7ab58 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/EnumType.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/EnumType.java @@ -14,8 +14,8 @@ import java.sql.SQLException; import java.sql.Types; import java.util.Locale; import java.util.Properties; -import javax.persistence.Enumerated; -import javax.persistence.MapKeyEnumerated; +import com.fr.third.javax.persistence.Enumerated; +import com.fr.third.javax.persistence.MapKeyEnumerated; import com.fr.third.org.hibernate.AssertionFailure; import com.fr.third.org.hibernate.HibernateException; @@ -41,7 +41,7 @@ import com.fr.third.org.jboss.logging.Logger; * *

  • * useNamed - Should enum be mapped via name. Default is to map as ordinal. Used when - * annotations are not used (otherwise {@link javax.persistence.EnumType} is used). + * annotations are not used (otherwise {@link com.fr.third.javax.persistence.EnumType} is used). *
  • *
  • * type - Identifies the JDBC type (via type code) to be used for the column. @@ -77,14 +77,14 @@ public class EnumType implements EnhancedUserType, DynamicParameterizedType,Logg enumClass = reader.getReturnedClass().asSubclass( Enum.class ); final boolean isOrdinal; - final javax.persistence.EnumType enumType = getEnumType( reader ); + final com.fr.third.javax.persistence.EnumType enumType = getEnumType( reader ); if ( enumType == null ) { isOrdinal = true; } - else if ( javax.persistence.EnumType.ORDINAL.equals( enumType ) ) { + else if ( com.fr.third.javax.persistence.EnumType.ORDINAL.equals( enumType ) ) { isOrdinal = true; } - else if ( javax.persistence.EnumType.STRING.equals( enumType ) ) { + else if ( com.fr.third.javax.persistence.EnumType.STRING.equals( enumType ) ) { isOrdinal = false; } else { @@ -113,8 +113,8 @@ public class EnumType implements EnhancedUserType, DynamicParameterizedType,Logg } } - private javax.persistence.EnumType getEnumType(ParameterType reader) { - javax.persistence.EnumType enumType = null; + private com.fr.third.javax.persistence.EnumType getEnumType(ParameterType reader) { + com.fr.third.javax.persistence.EnumType enumType = null; if ( reader.isPrimaryKey() ) { MapKeyEnumerated enumAnn = getAnnotation( reader.getAnnotationsMethod(), MapKeyEnumerated.class ); if ( enumAnn != null ) { diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java index b1e731fb3..22db527c1 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.type.descriptor.converter; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.type.descriptor.java.MutableMutabilityPlan; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterSqlTypeDescriptorAdapter.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterSqlTypeDescriptorAdapter.java index 9f1b718a4..cfca64d4e 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterSqlTypeDescriptorAdapter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterSqlTypeDescriptorAdapter.java @@ -10,8 +10,8 @@ import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import javax.persistence.AttributeConverter; -import javax.persistence.PersistenceException; +import com.fr.third.javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.PersistenceException; import com.fr.third.org.hibernate.type.descriptor.ValueBinder; import com.fr.third.org.hibernate.type.descriptor.ValueExtractor; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterTypeAdapter.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterTypeAdapter.java index 7477b0db6..c6d704a1c 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterTypeAdapter.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/AttributeConverterTypeAdapter.java @@ -6,7 +6,7 @@ */ package com.fr.third.org.hibernate.type.descriptor.converter; -import javax.persistence.AttributeConverter; +import com.fr.third.javax.persistence.AttributeConverter; import com.fr.third.org.hibernate.type.AbstractSingleColumnStandardBasicType; import com.fr.third.org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; diff --git a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/package-info.java b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/package-info.java index 9e03ad6cf..fda140197 100644 --- a/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/package-info.java +++ b/fine-hibernate/src/com/fr/third/org/hibernate/type/descriptor/converter/package-info.java @@ -6,7 +6,7 @@ */ /** - * Support for handling JPA {@link javax.persistence.AttributeConverter} instances as part of the + * Support for handling JPA {@link com.fr.third.javax.persistence.AttributeConverter} instances as part of the * Hibernate {@link com.fr.third.org.hibernate.type.Type} system. */ package com.fr.third.org.hibernate.type.descriptor.converter; diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Cause.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Cause.java index b7d575b38..a00904651 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Cause.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Cause.java @@ -29,7 +29,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; /** * Mark a parameter as being the "exception cause" parameter rather than a positional format parameter. * - * @deprecated Use org.jboss.logging.annotations.Cause provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.Cause provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Field.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Field.java index 153e7e054..749eab720 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Field.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Field.java @@ -29,7 +29,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; /** * Indicate that a method parameter value should be applied to a field on the resultant exception object. * - * @deprecated Use org.jboss.logging.annotations.Field provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.Field provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/FormatWith.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/FormatWith.java index 7b5d42115..696b4f74f 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/FormatWith.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/FormatWith.java @@ -33,7 +33,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * method will be invoked (or, if the format style is {@link Message.Format#PRINTF PRINTF}, the * object may implement {@link java.util.Formattable Formattable} to get extra functionality). * - * @deprecated Use org.jboss.logging.annotations.FormatWith provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.FormatWith provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LogMessage.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LogMessage.java index c51fc16b9..d3517341a 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LogMessage.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LogMessage.java @@ -30,7 +30,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * A typed logger method. Indicates that this method will log the associated {@link Message} to the logger system, as * opposed to being a simple message lookup. * - * @deprecated Use org.jboss.logging.annotations.LogMessage provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.LogMessage provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LoggingClass.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LoggingClass.java index 09c19cb36..ad052b50a 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LoggingClass.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/LoggingClass.java @@ -30,7 +30,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * Mark a parameter as specifying the name of the logging class to use. The parameter * may have a type of {@link String} or {@link Class}. * - * @deprecated Use org.jboss.logging.annotations.LoggingClass provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.LoggingClass provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Message.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Message.java index fe3bb2756..8296caed8 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Message.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Message.java @@ -30,7 +30,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * Assigns a message string to a resource method. The method arguments are used to supply the positional parameter * values for the method. * - * @deprecated Use org.jboss.logging.annotations.Message provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.Message provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageBundle.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageBundle.java index fca4af325..f1e88b51a 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageBundle.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageBundle.java @@ -29,7 +29,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; /** * Signify that an interface is a message bundle interface. * - * @deprecated Use org.jboss.logging.annotations.MessageBundle provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.MessageBundle provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageLogger.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageLogger.java index b345ac304..47f176099 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageLogger.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/MessageLogger.java @@ -30,7 +30,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * Signify that an interface is a typed logger interface. A message logger interface may optionally extend other message logger * interfaces and message bundle interfaces (see {@link MessageBundle}, as well as the {@link BasicLogger} interface. * - * @deprecated Use org.jboss.logging.annotations.MessageLogger provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.MessageLogger provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Param.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Param.java index f4d3df1f6..672ef5119 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Param.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Param.java @@ -35,7 +35,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * The {@link #value()} option will allow an optional class to be specified which will have to match the exact type of * the parameter in question, to enable unambiguous resolution. The value must be the fully qualified class name. * - * @deprecated Use org.jboss.logging.annotations.Param provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.Param provided in module org.jboss.logging:jboss-logging-annotations * * @author James R. Perkins */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Property.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Property.java index 3b2a3fcdd..97bc8bf25 100644 --- a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Property.java +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/Property.java @@ -30,7 +30,7 @@ import static java.lang.annotation.RetentionPolicy.CLASS; /** * Indicate that a method parameter value should be applied to a property (with a setter method) on the resultant exception object. * - * @deprecated Use org.jboss.logging.annotations.Property provided in module org.jboss.logging:jboss-logging-annotations + * @deprecated Use com.fr.third.org.jboss.logging.annotations.Property provided in module org.jboss.logging:jboss-logging-annotations * * @author David M. Lloyd */ diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Cause.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Cause.java new file mode 100644 index 000000000..94801eaa4 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Cause.java @@ -0,0 +1,38 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Mark a parameter as being the "exception cause" parameter rather than a positional format parameter. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface Cause { +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ConstructType.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ConstructType.java new file mode 100644 index 000000000..7ff50c1ee --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ConstructType.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicates the value of this annotation should be constructed and returned. This does not change the return type of + * the method. + *

    + * This annotation is only allowed on bundle messages that have a throwable return type. The value must be assignable + * to the return type. + *

    + * + * @author James R. Perkins + * @since 2.0.0 + */ +@Retention(CLASS) +@Target(METHOD) +@Documented +public @interface ConstructType { + + /** + * The actual type that should be constructed for the return type. + * + * @return the class to construct + */ + Class value(); +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Field.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Field.java new file mode 100644 index 000000000..b836e6cf7 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Field.java @@ -0,0 +1,45 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicate that a method parameter value should be applied to a field on the resultant exception object. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface Field { + + /** + * The field name. If not specified, the parameter name is assumed to be the field name. + * + * @return the field name + */ + String name() default ""; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/FormatWith.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/FormatWith.java new file mode 100644 index 000000000..5381761f6 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/FormatWith.java @@ -0,0 +1,49 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicate that the given parameter should be wrapped with a formatting object of the given class. The class + * must have a one-argument constructor which unambiguously accepts a value of this parameter's type. The resultant + * object will be passed in as a parameter to the underlying format type; thus its {@link Object#toString() toString()} + * method will be invoked (or, if the format style is {@link Message.Format#PRINTF PRINTF}, the object may implement + * {@link java.util.Formattable Formattable} to get extra functionality). + * + * @author David M. Lloyd + */ +@Target(PARAMETER) +@Retention(CLASS) +@Documented +public @interface FormatWith { + + /** + * The class of the formatting object to use. + * + * @return the class + */ + Class value(); +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LogMessage.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LogMessage.java new file mode 100644 index 000000000..e49f5057a --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LogMessage.java @@ -0,0 +1,55 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import com.fr.third.org.jboss.logging.Logger; + +/** + * A typed logger method. Indicates that this method will log the associated {@link Message} to the logger system, as + * opposed to being a simple message lookup. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(METHOD) +@Documented +public @interface LogMessage { + + /** + * The log level at which this message should be logged. Defaults to {@code INFO}. + * + * @return the log level + */ + Logger.Level level() default Logger.Level.INFO; + + /** + * The logging class name to use for this message, if any. + * + * @return the logging class name + */ + Class loggingClass() default Void.class; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LoggingClass.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LoggingClass.java new file mode 100644 index 000000000..504792e9f --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/LoggingClass.java @@ -0,0 +1,39 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Mark a parameter as specifying the name of the logging class to use. The parameter + * may have a type of {@link Class}. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface LoggingClass { +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Message.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Message.java new file mode 100644 index 000000000..a2155c9af --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Message.java @@ -0,0 +1,90 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Assigns a message string to a resource method. The method arguments are used to supply the positional parameter + * values for the method. + * + * @author David M. Lloyd + */ +@Target(METHOD) +@Retention(CLASS) +@Documented +public @interface Message { + + /** + * Indicates that this message has no ID. + */ + int NONE = 0; + /** + * Indicates that this message should inherit the ID from another message with the same name. + */ + int INHERIT = -1; + + /** + * The message ID number. Only one message with a given name may specify an ID other than {@link #INHERIT}. + * + * @return the message ID number + */ + int id() default INHERIT; + + /** + * The default format string of this message. + * + * @return the format string + */ + String value(); + + /** + * The format type of this method (defaults to {@link Format#PRINTF}). + * + * @return the format type + */ + Format format() default Format.PRINTF; + + /** + * The possible format types. + */ + enum Format { + + /** + * A {@link java.util.Formatter}-type format string. + */ + PRINTF, + /** + * A {@link java.text.MessageFormat}-type format string. + */ + MESSAGE_FORMAT, + + /** + * Indicates the message should not be formatted. + */ + NO_FORMAT, + } + +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageBundle.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageBundle.java new file mode 100644 index 000000000..0575b4a59 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageBundle.java @@ -0,0 +1,57 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Signify that an interface is a message bundle interface. + * + * @author David M. Lloyd + */ +@Target(TYPE) +@Retention(CLASS) +@Documented +public @interface MessageBundle { + + /** + * Get the project code for messages that have an associated code. If no project code is associated + * with this bundle, specify {@code ""} (the empty string). + * + * @return the project code + */ + String projectCode(); + + /** + * The length of the padding used for each id in the message bundle. For example given the default padding length + * of 6 and a message with an id of 100 would result would be {@code "000100"}. + *

    + * Valid values a range of 3 to 8. Any value less than 0 turns off padding. Any other value will result in an error + * being produced. + * + * @return the length the id should be padded + */ + int length() default 6; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageLogger.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageLogger.java new file mode 100644 index 000000000..edc31d296 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/MessageLogger.java @@ -0,0 +1,59 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Signify that an interface is a typed logger interface. A message logger interface may optionally extend other + * message logger interfaces and message bundle interfaces (see {@link com.fr.third.org.jboss.logging.annotations.MessageBundle}, as + * well as the {@link org.jboss.logging.BasicLogger} interface. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(TYPE) +@Documented +public @interface MessageLogger { + + /** + * Get the project code for messages that have an associated code. If no project code is associated + * with this logger, specify {@code ""} (the empty string). + * + * @return the project code + */ + String projectCode(); + + /** + * The length of the padding used for each id in the message bundle. For example given the default padding length + * of 6 and a message with an id of 100 would result would be {@code "000100"}. + *

    + * Valid values a range of 3 to 8. Any value less than 0 turns off padding. Any other value will result in an error + * being produced. + * + * @return the length the id should be padded + */ + int length() default 6; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Once.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Once.java new file mode 100644 index 000000000..8afbf4266 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Once.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicates a message should only be logged once. + *

    + * Methods that use this annotation must be {@linkplain com.fr.third.org.jboss.logging.annotations.LogMessage logger methods}. Overloaded + * methods also annotated with {@code @Once} will inherit the same check only logging the message from the first + * overloaded method invoked. + *

    + * + * @author James R. Perkins + */ +@Target(METHOD) +@Retention(CLASS) +@Documented +public @interface Once { +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Param.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Param.java new file mode 100644 index 000000000..1e4ff861f --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Param.java @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Identifies a parameter is to be used for constructing an exception and excluded from the formatting of the message. + *

    + * Parameters will be order-matched first, then type-matched to resolve ambiguity. If a match fails an error should + * occur. + *

    + * The {@link #value()} option will allow an optional class to be specified which will have to match the exact type of + * the parameter in question, to enable unambiguous resolution. The value must be the fully qualified class name. + * + * @author James R. Perkins + */ +@Target(PARAMETER) +@Retention(CLASS) +@Documented +public @interface Param { + + /** + * Defines an exact class the parameter must match for unambiguous resolution. + * + * @return the class the parameter must match. + */ + Class value() default Object.class; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Pos.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Pos.java new file mode 100644 index 000000000..59edfec96 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Pos.java @@ -0,0 +1,53 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * @author James R. Perkins + * @since 1.1.0 + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface Pos { + + /** + * The positions the value should be used at. + * + * @return an array of the positions for the parameter + */ + int[] value(); + + /** + * The transform types used on the parameter. + * + * @return an array of the transformer types + * + * @see Transform + */ + Transform[] transform() default {}; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Property.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Property.java new file mode 100644 index 000000000..881d78792 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Property.java @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicate that a method parameter value should be applied to a property (with a setter method) on the resultant exception object. + * + * @author David M. Lloyd + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface Property { + + /** + * The property name. If not specified, the parameter name is assumed to be the property name. + * + * @return the property name + */ + String name() default ""; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Transform.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Transform.java new file mode 100644 index 000000000..a37c8b62e --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/Transform.java @@ -0,0 +1,85 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Indicate the given parameter should be transformed in each of the {@link com.fr.third.org.jboss.logging.annotations.Transform.TransformType transform types} + * provided. The parameter cannot be a primitive type. + *

    + * For the {@link TransformType#SIZE} type, the object must be a {@link String}, a {@link java.util.Collection}, a + * {@link java.util.Map} or an array. + *

    + * The type {@link TransformType#GET_CLASS} can be used with {@link TransformType#HASH_CODE} or {@link + * TransformType#IDENTITY_HASH_CODE}. The type {@link TransformType#SIZE} must be used on it's own. + * + * @author James R. Perkins + * @since 1.1.0 + */ +@Retention(CLASS) +@Target(PARAMETER) +@Documented +public @interface Transform { + + /** + * The transform type + */ + public enum TransformType { + /** + * Gets the class of the object object passed, {@link Object#getClass()}. + */ + GET_CLASS, + /** + * Gets the hash code of the object, {@link Object#hashCode()}. + */ + HASH_CODE, + /** + * Gets the identity hash code of the object, {@link System#identityHashCode(Object)}. + */ + IDENTITY_HASH_CODE, + /** + * Gets the size or length of a {@link String}, {@link java.util.Collection}, {@link java.util.Map} or array. + */ + SIZE, + } + + /** + * The transform types used on the parameter. + *

    + * Valid combinations: + *

      + *
    • {@link TransformType#GET_CLASS}
    • + *
    • {@link TransformType#GET_CLASS}, {@link TransformType#HASH_CODE}
    • + *
    • {@link TransformType#GET_CLASS}, {@link TransformType#IDENTITY_HASH_CODE}
    • + *
    • {@link TransformType#HASH_CODE}
    • + *
    • {@link TransformType#IDENTITY_HASH_CODE}
    • + *
    • {@link TransformType#SIZE}
    • + *
    + * + * @return an array of the transform types + */ + TransformType[] value(); +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRange.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRange.java new file mode 100644 index 000000000..42ff2b5b0 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRange.java @@ -0,0 +1,71 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Sets a range of valid id's allowed on the {@link com.fr.third.org.jboss.logging.annotations.Message#id() message id}. Both {@link + * Message#INHERIT} and {@link Message#NONE} are ignored when validating. + *

    + * Note: Message id's from inherited interfaces are not validated within the range provided. Super interfaces + * would need their own annotation for range validation. + *

    + * + *

    + *          @MessageLogger(projectCode = "EXAMPLE")
    + *          @ValidIdRange(min = 100, max = 200)
    + *          public interface ExampleLogger {
    + *
    + *              @LogMessage
    + *              @Message(id = 100, value = "Example message")
    + *              void example();
    + *          }
    + * 
    + * + * + * @author James R. Perkins + */ +@Target(TYPE) +@Retention(CLASS) +@Documented +public @interface ValidIdRange { + + /** + * The minimum id allowed in the {@link com.fr.third.org.jboss.logging.annotations.Message#id() message id}. Both {@link + * Message#INHERIT} and {@link Message#NONE} are ignored when validating. + * + * @return the minimum id allowed + */ + int min() default 1; + + /** + * The maximum id allowed in the {@link com.fr.third.org.jboss.logging.annotations.Message#id() message id}. Both {@link + * Message#INHERIT} and {@link Message#NONE} are ignored when validating. + * + * @return the maximum id allowed + */ + int max() default 999999; +} diff --git a/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRanges.java b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRanges.java new file mode 100644 index 000000000..81d4cf9f5 --- /dev/null +++ b/fine-jboss-logging/src/com/fr/third/org/jboss/logging/annotations/ValidIdRanges.java @@ -0,0 +1,43 @@ +/* + * JBoss, Home of Professional Open Source. + * + * Copyright 2015 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fr.third.org.jboss.logging.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * @author James R. Perkins + */ +@Target(TYPE) +@Retention(CLASS) +@Documented +public @interface ValidIdRanges { + + /** + * An array of valid id ranges. + * + * @return an array of valid id ranges + */ + ValidIdRange[] value(); +} diff --git a/fine-jpa/README.md b/fine-jpa/README.md new file mode 100644 index 000000000..6b106bf20 --- /dev/null +++ b/fine-jpa/README.md @@ -0,0 +1,5 @@ +# fine-jpa + +改包名的jpa(2.1),以下模块需要依赖该模块: + +- fine-hibernate diff --git a/fine-jpa/fine-jpa.iml b/fine-jpa/fine-jpa.iml new file mode 100644 index 000000000..c90834f2d --- /dev/null +++ b/fine-jpa/fine-jpa.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Access.java b/fine-jpa/src/com/fr/third/javax/persistence/Access.java new file mode 100644 index 000000000..e333763fd --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Access.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to specify an access type to be applied to an entity class, + * mapped superclass, or embeddable class, or to a specific attribute + * of such a class. + * + * @since Java Persistence 2.0 + */ +@Target( { TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Access { + + /** + * (Required) Specification of field- or property-based access. + */ + AccessType value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AccessType.java b/fine-jpa/src/com/fr/third/javax/persistence/AccessType.java new file mode 100644 index 000000000..b3dabb088 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AccessType.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Is used with the {@link Access} annotation to specify an access + * type to be applied to an entity class, mapped superclass, or + * embeddable class, or to a specific attribute of such a class. + * + * @see Access + * + * @since Java Persistence 2.0 + */ +public enum AccessType { + + /** Field-based access is used. */ + FIELD, + + /** Property-based access is used. */ + PROPERTY +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverride.java b/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverride.java new file mode 100644 index 000000000..b600bc79e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverride.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override a mapping for an entity relationship. + * + *

    May be applied to an entity that extends a mapped superclass to + * override a relationship mapping defined by the mapped + * superclass. If not specified, the association is mapped the same as + * in the original mapping. When used to override a mapping defined by + * a mapped superclass, AssociationOverride is applied to + * the entity class. + * + *

    May be used to override a relationship mapping from an + * embeddable within an entity to another entity when the embeddable + * is on the owning side of the relationship. When used to override a + * relationship mapping defined by an embeddable class (including an + * embeddable class embedded within another embeddable class), + * AssociationOverride is applied to the field or + * property containing the embeddable. + * + *

    When AssociationOverride is used to override a + * relationship mapping from an embeddable class, the + * name element specifies the referencing relationship + * field or property within the embeddable class. To override mappings + * at multiple levels of embedding, a dot (".") notation syntax must + * be used in the name element to indicate an attribute + * within an embedded attribute. The value of each identifier used + * with the dot notation is the name of the respective embedded field + * or property. + * + *

    When AssociationOverride is applied to override + * the mappings of an embeddable class used as a map value, + * "value." must be used to prefix the name of the + * attribute within the embeddable class that is being overridden in + * order to specify it as part of the map value. + * + *

    If the relationship mapping is a foreign key mapping, the + * joinColumns element is used. If the relationship + * mapping uses a join table, the joinTable element must + * be specified to override the mapping of the join table and/or its + * join columns. + * + *

    + *

    + *    Example 1: Overriding the mapping of a relationship defined by a mapped superclass
    + *
    + *    @MappedSuperclass
    + *    public class Employee {
    + *        ...
    + *        @ManyToOne
    + *        protected Address address;
    + *        ...
    + *    }
    + *
    + *    @Entity
    + *        @AssociationOverride(name="address",
    + *                             joinColumns=@JoinColumn(name="ADDR_ID"))
    + *        // address field mapping overridden to ADDR_ID foreign key
    + *    public class PartTimeEmployee extends Employee {
    + *        ...
    + *    }
    + * 
    + * + *
    + *    Example 2: Overriding the mapping for phoneNumbers defined in the ContactInfo class
    + *
    + *    @Entity
    + *    public class Employee {
    + *        @Id int id;
    + *        @AssociationOverride(
    + *          name="phoneNumbers",
    + *          joinTable=@JoinTable(
    + *             name="EMPPHONES",
    + *             joinColumns=@JoinColumn(name="EMP"),
    + *             inverseJoinColumns=@JoinColumn(name="PHONE")
    + *          )
    + *        )
    + *        @Embedded ContactInfo contactInfo;
    + *       ...
    + *    }
    + *
    + *    @Embeddable
    + *    public class ContactInfo {
    + *        @ManyToOne Address address; // Unidirectional
    + *        @ManyToMany(targetEntity=PhoneNumber.class) List phoneNumbers;
    + *    }
    + *
    + *    @Entity
    + *    public class PhoneNumber {
    + *        @Id int number;
    + *        @ManyToMany(mappedBy="contactInfo.phoneNumbers")
    + *        Collection<Employee> employees;
    + *     }
    + *    
    + * + * @see Embedded + * @see Embeddable + * @see MappedSuperclass + * @see AttributeOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AssociationOverride { + + /** + * (Required) The name of the relationship property whose mapping is + * being overridden if property-based access is being used, + * or the name of the relationship field if field-based access is used. + */ + String name(); + + /** + * The join column(s) being mapped to the persistent attribute(s). + * The joinColumns elements must be specified if a + * foreign key mapping is used in the overriding of the mapping of + * the relationship. The joinColumns element must + * not be specified if a join table is used in the overriding of + * the mapping of the relationship. + */ + JoinColumn[] joinColumns() default {}; + + /** + * The join table that maps the relationship. + * The joinTable element must be specified if a join table + * is used in the overriding of the mapping of the + * relationship. The joinTable element must not be specified + * if a foreign key mapping is used in the overriding of + * the relationship. + * + * @since Java Persistence 2.0 + */ + JoinTable joinTable() default @JoinTable; + + /** + * (Optional) Used to specify or control the generation of a foreign key constraint for the columns + * corresponding to the joinColumns element when table generation is in effect. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverrides.java b/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverrides.java new file mode 100644 index 000000000..a3b34d876 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AssociationOverrides.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override mappings of multiple relationship properties or fields. + * + *
    + *
    + *    Example:
    + *
    + *    @MappedSuperclass
    + *    public class Employee {
    + *
    + *        @Id protected Integer id;
    + *        @Version protected Integer version;
    + *        @ManyToOne protected Address address;
    + *        @OneToOne protected Locker locker;
    + *
    + *        public Integer getId() { ... }
    + *        public void setId(Integer id) { ... }
    + *        public Address getAddress() { ... }
    + *        public void setAddress(Address address) { ... }
    + *        public Locker getLocker() { ... }
    + *        public void setLocker(Locker locker) { ... }
    + *        ...
    + *    }
    + *
    + *    @Entity
    + *    @AssociationOverrides({
    + *        @AssociationOverride(
    + *                   name="address",
    + *                   joinColumns=@JoinColumn("ADDR_ID")),
    + *        @AttributeOverride(
    + *                   name="locker",
    + *                   joinColumns=@JoinColumn("LCKR_ID"))
    + *        })
    + *    public PartTimeEmployee { ... }
    + * 
    + * + *@see AssociationOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AssociationOverrides { + + /** + *(Required) The association override mappings that are to be + * applied to the relationship field or property . + */ + AssociationOverride[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AttributeConverter.java b/fine-jpa/src/com/fr/third/javax/persistence/AttributeConverter.java new file mode 100644 index 000000000..6b626d38b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AttributeConverter.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * A class that implements this interface can be used to convert + * entity attribute state into database column representation + * and back again. + * Note that the X and Y types may be the same Java type. + * + * @param X the type of the entity attribute + * @param Y the type of the database column + * + * @since Java Persistence 2.1 + */ +public interface AttributeConverter { + /** + * Converts the value stored in the entity attribute into the + * data representation to be stored in the database. + * + * @param attribute the entity attribute value to be converted + * @return the converted data to be stored in the database column + */ + public Y convertToDatabaseColumn (X attribute); + + /** + * Converts the data stored in the database column into the + * value to be stored in the entity attribute. + * Note that it is the responsibility of the converter writer to + * specify the correct dbData type for the corresponding column + * for use by the JDBC driver: i.e., persistence providers are + * not expected to do such type conversion. + * + * @param dbData the data from the database column to be converted + * @return the converted value to be stored in the entity attribute + */ + public X convertToEntityAttribute (Y dbData); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AttributeNode.java b/fine-jpa/src/com/fr/third/javax/persistence/AttributeNode.java new file mode 100644 index 000000000..9ded591a7 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AttributeNode.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.util.Map; + +/** + * Represents an attribute node of an entity graph. + * + * @param The type of the attribute. + * + * @since JPA 2.1 + */ +public interface AttributeNode { + /** + * Return the name of the attribute corresponding to the attribute node. + * + * @return name of the attribute + */ + public String getAttributeName(); + + /** + * Return the Map of subgraphs associated with this attribute node. + * + * @return Map of subgraphs associated with this attribute node or empty Map if none have been defined + */ + public Map getSubgraphs(); + + /** + * Return the Map of subgraphs associated with this attribute node's map key. + * + * @return Map of subgraphs associated with this attribute node's map key or empty Map if none have been defined + */ + public Map getKeySubgraphs(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverride.java b/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverride.java new file mode 100644 index 000000000..8b8c1378f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverride.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override the mapping of a Basic (whether + * explicit or default) property or field or Id property or + * field. + * + *

    May be applied to an entity that extends a mapped superclass or + * to an embedded field or property to override a basic mapping or id + * mapping defined by the mapped superclass or embeddable class (or + * embeddable class of one of its attributes). + + *

    May be applied to an element collection containing instances of + * an embeddable class or to a map collection whose key and/or value + * is an embeddable class. When AttributeOverride is + * applied to a map, "key." or "value." must + * be used to prefix the name of the attribute that is being + * overridden in order to specify it as part of the map key or map + * value. + * + *

    To override mappings at multiple levels of embedding, a dot (".") + * notation form must be used in the name element to indicate an + * attribute within an embedded attribute. The value of each identifier + * used with the dot notation is the name of the respective embedded + * field or property. + * + *

    If AttributeOverride is not specified, the column + * is mapped the same as in the original mapping. + * + *

    + *    Example 1:
    + *
    + *    @MappedSuperclass
    + *    public class Employee {
    + *        @Id protected Integer id;
    + *        @Version protected Integer version;
    + *        protected String address;
    + *        public Integer getId() { ... }
    + *        public void setId(Integer id) { ... }
    + *        public String getAddress() { ... }
    + *        public void setAddress(String address) { ... }
    + *    }
    + *
    + *    @Entity
    + *    @AttributeOverride(name="address", column=@Column(name="ADDR"))
    + *    public class PartTimeEmployee extends Employee {
    + *        // address field mapping overridden to ADDR
    + *        protected Float wage();
    + *        public Float getHourlyWage() { ... }
    + *        public void setHourlyWage(Float wage) { ... }
    + *    }
    + *
    + *
    + *    Example 2:
    + *
    + *    @Embeddable public class Address {
    + *        protected String street;
    + *        protected String city;
    + *        protected String state;
    + *        @Embedded protected Zipcode zipcode;
    + *    }
    + *
    + *    @Embeddable public class Zipcode {
    + *        protected String zip;
    + *        protected String plusFour;
    + *    }
    + *
    + *    @Entity public class Customer {
    + *        @Id protected Integer id;
    + *        protected String name;
    + *        @AttributeOverrides({
    + *            @AttributeOverride(name="state",
    + *                               column=@Column(name="ADDR_STATE")),
    + *            @AttributeOverride(name="zipcode.zip",
    + *                               column=@Column(name="ADDR_ZIP"))
    + *        })
    + *        @Embedded protected Address address;
    + *        ...
    + *    }
    + *
    + *
    + *    Example 3:
    + *
    + *    @Entity public class PropertyRecord {
    + *        @EmbeddedId PropertyOwner owner;
    + *        @AttributeOverrides({
    + *            @AttributeOverride(name="key.street",
    + *                               column=@Column(name="STREET_NAME")),
    + *            @AttributeOverride(name="value.size",
    + *                               column=@Column(name="SQUARE_FEET")),
    + *            @AttributeOverride(name="value.tax",
    + *                               column=@Column(name="ASSESSMENT"))
    + *        })
    + *       @ElementCollection
    + *       Map<Address, PropertyInfo> parcels;
    + *    }
    + *
    + *   @Embeddable public class PropertyInfo {
    + *       Integer parcelNumber;
    + *       Integer size;
    + *       BigDecimal tax;
    + *   }
    + *
    + * 
    + * + * @see Embedded + * @see Embeddable + * @see MappedSuperclass + * @see AssociationOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AttributeOverride { + + /** + * (Required) The name of the property whose mapping is being + * overridden if property-based access is being used, or the + * name of the field if field-based access is used. + */ + String name(); + + /** + * (Required) The column that is being mapped to the persistent + * attribute. The mapping type will remain the same as is + * defined in the embeddable class or mapped superclass. + */ + Column column(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverrides.java b/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverrides.java new file mode 100644 index 000000000..4d2fe103c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/AttributeOverrides.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to override mappings of multiple properties or fields. + * + *
    + *
    + *    Example:
    + *
    + *    @Embedded
    + *    @AttributeOverrides({
    + *            @AttributeOverride(name="startDate",
    + *                               column=@Column("EMP_START")),
    + *            @AttributeOverride(name="endDate",
    + *                               column=@Column("EMP_END"))
    + *    })
    + *    public EmploymentPeriod getEmploymentPeriod() { ... }
    + *
    + * 
    + * + * + * @see AttributeOverride + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface AttributeOverrides { + + /** (Required) One or more field or property mapping overrides. */ + AttributeOverride[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Basic.java b/fine-jpa/src/com/fr/third/javax/persistence/Basic.java new file mode 100644 index 000000000..f473f074c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Basic.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.EAGER; + +/** + * The simplest type of mapping to a database column. The + * Basic annotation can be applied to a persistent + * property or instance variable of any of the following types: Java + * primitive types, wrappers of the primitive types, String, + * java.math.BigInteger, + * java.math.BigDecimal, + * java.util.Date, + * java.util.Calendar, + * java.sql.Date, + * java.sql.Time, + * java.sql.Timestamp, byte[], Byte[], + * char[], Character[], enums, and any other type that + * implements java.io.Serializable. + * + *

    The use of the Basic annotation is optional for + * persistent fields and properties of these types. If the + * Basic annotation is not specified for such a field or + * property, the default values of the Basic annotation + * will apply. + * + *

    + *    Example 1:
    + *
    + *    @Basic
    + *    protected String name;
    + *
    + *    Example 2:
    + *
    + *    @Basic(fetch=LAZY)
    + *    protected String getName() { return name; }
    + *
    + * 
    + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Basic { + + /** + * (Optional) Defines whether the value of the field or property should + * be lazily loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime + * that the value must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + * If not specified, defaults to EAGER. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Defines whether the value of the field or property may be null. + * This is a hint and is disregarded for primitive types; it may + * be used in schema generation. + * If not specified, defaults to true. + */ + boolean optional() default true; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Cache.java b/fine-jpa/src/com/fr/third/javax/persistence/Cache.java new file mode 100644 index 000000000..b24c20305 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Cache.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Interface used to interact with the second-level cache. + * If a cache is not in use, the methods of this interface have + * no effect, except for contains, which returns false. + * + * @since Java Persistence 2.0 + */ +public interface Cache { + + /** + * Whether the cache contains data for the given entity. + * @param cls entity class + * @param primaryKey primary key + * @return boolean indicating whether the entity is in the cache + */ + public boolean contains(Class cls, Object primaryKey); + + /** + * Remove the data for the given entity from the cache. + * @param cls entity class + * @param primaryKey primary key + */ + public void evict(Class cls, Object primaryKey); + + /** + * Remove the data for entities of the specified class (and its + * subclasses) from the cache. + * @param cls entity class + */ + public void evict(Class cls); + + /** + * Clear the cache. + */ + public void evictAll(); + + /** + * Return an object of the specified type to allow access to the provider-specific API. + * + * If the provider's Cache implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is normally either the + * underlying Cache implementation class or an interface that it implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not support the call + */ + public T unwrap(Class cls); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/CacheRetrieveMode.java b/fine-jpa/src/com/fr/third/javax/persistence/CacheRetrieveMode.java new file mode 100644 index 000000000..7f74a3550 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/CacheRetrieveMode.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Used as the value of the + * com.fr.third.javax.persistence.cache.retrieveMode property to + * specify the behavior when data is retrieved by the + * find methods and by queries. + * + * @since Java Persistence 2.0 + */ +public enum CacheRetrieveMode { + + /** + * Read entity data from the cache: this is + * the default behavior. + */ + USE, + + /** + * Bypass the cache: get data directly from + * the database. + */ + BYPASS +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/CacheStoreMode.java b/fine-jpa/src/com/fr/third/javax/persistence/CacheStoreMode.java new file mode 100644 index 000000000..c2b5f8be1 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/CacheStoreMode.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Used as the value of the + * com.fr.third.javax.persistence.cache.storeMode property to specify + * the behavior when data is read from the database and when data is + * committed into the database. + * + * @since Java Persistence 2.0 + */ +public enum CacheStoreMode { + + /** + * Insert/update entity data into cache when read + * from database and when committed into database: + * this is the default behavior. Does not force refresh + * of already cached items when reading from database. + */ + USE, + + /** + * Don't insert into cache. + */ + BYPASS, + + /** + * Insert/update entity data into cache when read + * from database and when committed into database. + * Forces refresh of cache for items read from database. + */ + REFRESH +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Cacheable.java b/fine-jpa/src/com/fr/third/javax/persistence/Cacheable.java new file mode 100644 index 000000000..bbbeddd54 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Cacheable.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies whether an entity should be cached if caching is enabled + * when the value of the persistence.xml caching element + * is ENABLE_SELECTIVE or DISABLE_SELECTIVE. + * The value of the Cacheable annotation is inherited by + * subclasses; it can be overridden by specifying + * Cacheable on a subclass. + * + *

    Cacheable(false) means that the entity and its state must + * not be cached by the provider. + * + * @since Java Persistence 2.0 + */ +@Target( { TYPE }) +@Retention(RUNTIME) +public @interface Cacheable { + + /** + * (Optional) Whether or not the entity should be cached. + */ + boolean value() default true; +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/CascadeType.java b/fine-jpa/src/com/fr/third/javax/persistence/CascadeType.java new file mode 100644 index 000000000..336d44f9d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/CascadeType.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines the set of cascadable operations that are propagated + * to the associated entity. + * The value cascade=ALL is equivalent to + * cascade={PERSIST, MERGE, REMOVE, REFRESH, DETACH}. + * + * @since Java Persistence 1.0 + */ +public enum CascadeType { + + /** Cascade all operations */ + ALL, + + /** Cascade persist operation */ + PERSIST, + + /** Cascade merge operation */ + MERGE, + + /** Cascade remove operation */ + REMOVE, + + /** Cascade refresh operation */ + REFRESH, + + /** + * Cascade detach operation + * + * @since Java Persistence 2.0 + * + */ + DETACH +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/CollectionTable.java b/fine-jpa/src/com/fr/third/javax/persistence/CollectionTable.java new file mode 100644 index 000000000..618a4e02c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/CollectionTable.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the table that is used for the mapping of + * collections of basic or embeddable types. Applied + * to the collection-valued field or property. + * + *

    By default, the columns of the collection table that correspond + * to the embeddable class or basic type are derived from the + * attributes of the embeddable class or from the basic type according + * to the default values of the Column annotation. In the case + * of a basic type, the column name is derived from the name of the + * collection-valued field or property. In the case of an embeddable + * class, the column names are derived from the field or property + * names of the embeddable class. + *

      + *
    • To override the default properties of the column used for a + * basic type, the Column annotation is used on the + * collection-valued attribute in addition to the + * ElementCollection annotation. + * + *
    • To override these defaults for an embeddable class, the + * AttributeOverride and/or + * AttributeOverrides annotations can be used in + * addition to the ElementCollection annotation. If the + * embeddable class contains references to other entities, the default + * values for the columns corresponding to those references may be + * overridden by means of the AssociationOverride and/or + * AssociationOverrides annotations. + *
    + * + *

    If the CollectionTable annotation is missing, the + * default values of the CollectionTable annotation + * elements apply. + * + *

    + *    Example:
    + *
    + *    @Embeddable public class Address {
    + *       protected String street;
    + *       protected String city;
    + *       protected String state;
    + *       ...
    + *     }
    + *
    + *    @Entity public class Person {
    + *       @Id protected String ssn;
    + *       protected String name;
    + *       protected Address home;
    + *       ...
    + *       @ElementCollection  // use default table (PERSON_NICKNAMES)
    + *       @Column(name="name", length=50)
    + *       protected Set<String> nickNames = new HashSet();
    + *       ...
    + *    }
    + *
    + *    @Entity public class WealthyPerson extends Person {
    + *       @ElementCollection
    + *       @CollectionTable(name="HOMES") // use default join column name
    + *       @AttributeOverrides({
    + *          @AttributeOverride(name="street",
    + *                             column=@Column(name="HOME_STREET")),
    + *          @AttributeOverride(name="city",
    + *                             column=@Column(name="HOME_CITY")),
    + *          @AttributeOverride(name="state",
    + *                             column=@Column(name="HOME_STATE"))
    + *        })
    + *       protected Set<Address> vacationHomes = new HashSet();
    + *       ...
    + *    }
    + * 
    + * + * @see ElementCollection + * @see AttributeOverride + * @see AssociationOverride + * @see Column + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface CollectionTable { + + /** + * (Optional) The name of the collection table. If not specified, + * it defaults to the concatenation of the name of the containing + * entity and the name of the collection attribute, separated by + * an underscore. + */ + String name() default ""; + + /** + * (Optional) The catalog of the table. If not specified, the + * default catalog is used. + */ + String catalog() default ""; + + /** + * (Optional) The schema of the table. If not specified, the + * default schema for the user is used. + */ + String schema() default ""; + + /** + * (Optional) The foreign key columns of the collection table + * which reference the primary table of the entity. The default + * only applies if a single join column is used. The default is + * the same as for JoinColumn (i.e., the + * concatenation of the following: the name of the entity; "_"; + * the name of the referenced primary key column.) However, if + * there is more than one join column, a JoinColumn + * annotation must be specified for each join column using the + * JoinColumns annotation. In this case, both the + * name and the referencedColumnName + * elements must be specified in each such + * JoinColumn annotation. + */ + JoinColumn[] joinColumns() default {}; + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are only used if table generation is in effect. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if table generation is in effect. + * + * @return The indexes + */ + Index[] indexes() default {}; + + /** + * (Optional) Used to specify or control the generation of a foreign key constraint for the columns + * corresponding to the joinColumns element when table generation is in effect. If both this element + * and the foreignKey element of any of the joinColumns elements are specified, the behavior is undefined. + * If no foreign key annotation element is specified in either location, the persistence provider's default + * foreign key strategy will apply. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Column.java b/fine-jpa/src/com/fr/third/javax/persistence/Column.java new file mode 100644 index 000000000..d259e8d3a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Column.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify the mapped column for a persistent property or field. + * If no Column annotation is specified, the default values apply. + * + *
    + *    Example 1:
    + *
    + *    @Column(name="DESC", nullable=false, length=512)
    + *    public String getDescription() { return description; }
    + *
    + *    Example 2:
    + *
    + *    @Column(name="DESC",
    + *            columnDefinition="CLOB NOT NULL",
    + *            table="EMP_DETAIL")
    + *    @Lob
    + *    public String getDescription() { return description; }
    + *
    + *    Example 3:
    + *
    + *    @Column(name="ORDER_COST", updatable=false, precision=12, scale=2)
    + *    public BigDecimal getCost() { return cost; }
    + *
    + * 
    + * + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Column { + + /** + * (Optional) The name of the column. Defaults to + * the property or field name. + */ + String name() default ""; + + /** + * (Optional) Whether the column is a unique key. This is a + * shortcut for the UniqueConstraint annotation at the table + * level and is useful for when the unique key constraint + * corresponds to only a single column. This constraint applies + * in addition to any constraint entailed by primary key mapping and + * to constraints specified at the table level. + */ + boolean unique() default false; + + /** + * (Optional) Whether the database column is nullable. + */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in SQL INSERT + * statements generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE + * statements generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when + * generating the DDL for the column. + *

    Defaults to the generated SQL to create a + * column of the inferred type. + */ + String columnDefinition() default ""; + + /** + * (Optional) The name of the table that contains the column. + * If absent the column is assumed to be in the primary table. + */ + String table() default ""; + + /** + * (Optional) The column length. (Applies only if a + * string-valued column is used.) + */ + int length() default 255; + + /** + * (Optional) The precision for a decimal (exact numeric) + * column. (Applies only if a decimal column is used.) + * Value must be set by developer if used when generating + * the DDL for the column. + */ + int precision() default 0; + + /** + * (Optional) The scale for a decimal (exact numeric) column. + * (Applies only if a decimal column is used.) + */ + int scale() default 0; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ColumnResult.java b/fine-jpa/src/com/fr/third/javax/persistence/ColumnResult.java new file mode 100644 index 000000000..dc67767b3 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ColumnResult.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * References name of a column in the SELECT clause of a SQL query - + * i.e., column alias, if applicable. Scalar result types can be + * included in the query result by specifying this annotation in + * the metadata. + * + *

    + *
    + * Example:
    + *   Query q = em.createNativeQuery(
    + *       "SELECT o.id AS order_id, " +
    + *           "o.quantity AS order_quantity, " +
    + *           "o.item AS order_item, " +
    + *           "i.name AS item_name, " +
    + *         "FROM Order o, Item i " +
    + *         "WHERE (order_quantity > 25) AND (order_item = i.id)",
    + *       "OrderResults");
    + *
    + *   @SqlResultSetMapping(name="OrderResults",
    + *       entities={
    + *           @EntityResult(entityClass=com.acme.Order.class, fields={
    + *               @FieldResult(name="id", column="order_id"),
    + *               @FieldResult(name="quantity", column="order_quantity"),
    + *               @FieldResult(name="item", column="order_item")})},
    + *       columns={
    + *           @ColumnResult(name="item_name")}
    + *       )
    + * 
    + * + * @see SqlResultSetMapping + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface ColumnResult { + + /** (Required) The name of a column in the SELECT clause of a SQL query */ + String name(); + + /** (Optional) The Java type to which the column type is to be mapped. */ + Class type() default void.class; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ConstraintMode.java b/fine-jpa/src/com/fr/third/javax/persistence/ConstraintMode.java new file mode 100644 index 000000000..7166213a9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ConstraintMode.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2013 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Used to control the application of a constraint. + * + * @since JPA 2.1 + */ +public enum ConstraintMode { + /** + * Apply the constraint. + */ + CONSTRAINT, + /** + * Do not apply the constraint. + */ + NO_CONSTRAINT, + /** + * Use the provider-defined default behavior. + */ + PROVIDER_DEFAULT +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ConstructorResult.java b/fine-jpa/src/com/fr/third/javax/persistence/ConstructorResult.java new file mode 100644 index 000000000..a1a8a0052 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ConstructorResult.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used in conjunction with the {@link SqlResultSetMapping} annotation to map + * the SELECT clause of a SQL query to a constructor. + *

    + * Applies a constructor for the target class, passing in as arguments values + * from the specified columns. All columns corresponding to arguments of the + * intended constructor must be specified using the {@code columns} element of the + * {@code ConstructorResult} annotation in the same order as that of the argument + * list of the constructor. Any entities returned as constructor results will be + * in either the new or detached state, depending on whether a primary key is + * retrieved for the constructed object. + *

    + * Example: + *

    + *     Query q = em.createNativeQuery(
    + *     		"SELECT c.id, c.name, COUNT(o) as orderCount, AVG(o.price) AS avgOrder " +
    + *     			"FROM Customer c, Orders o " +
    + *     			"WHERE o.cid = c.id " +
    + *     			"GROUP BY c.id, c.name",
    + *     		"CustomerDetailsResult"
    + *    );
    + *
    + *    @SqlResultSetMapping(
    + *    		name="CustomerDetailsResult",
    + *    		classes = {
    + *    			@ConstructorResult(
    + *    				targetClass=com.acme.CustomerDetails.class,
    + *    				columns={
    + *    					@ColumnResult(name="id"),
    + *    					@ColumnResult(name="name"),
    + *    					@ColumnResult(name="orderCount"),
    + *    					@ColumnResult(name="avgOrder", type=Double.class)
    + *    			    }
    + *    		    )
    + *    		}
    + * 
    + */ +@Target(value={}) @Retention(RUNTIME) +public @interface ConstructorResult { + /** (Required) The class whose constructor is to be invoked. */ + Class targetClass(); + + /** (Required) The mapping of columns in the SELECT list to the arguments of the intended constructor, in order. */ + ColumnResult[] columns(); +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Convert.java b/fine-jpa/src/com/fr/third/javax/persistence/Convert.java new file mode 100644 index 000000000..a75f8111b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Convert.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The Convert annotation is used to specify the conversion of a Basic field or + * property. It is not necessary to use the Basic annotation or corresponding XML + * element to specify the basic type. + * + * @since Java Persistence 2.1 + */ +@Target({METHOD, FIELD, TYPE}) +@Retention(RUNTIME) +public @interface Convert { + /** + * Specifies the converter to be applied. A value for this + * element must be specified if multiple converters would + * otherwise apply. + */ + Class converter() default void.class; + /** + * The attributeName must be specified unless the Convert annotation + * is on an attribute of basic type or on an element collection of + * basic type. In these cases, attributeName must not be + * specified. + */ + String attributeName() default ""; + + /** + * Used to disable an auto-apply or inherited converter. + * If disableConversion is true, the converter element should + * not be specified. + */ + boolean disableConversion() default false; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Converter.java b/fine-jpa/src/com/fr/third/javax/persistence/Converter.java new file mode 100644 index 000000000..b88d694b3 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Converter.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Target(TYPE) +@Retention(RUNTIME) +public @interface Converter { + boolean autoApply() default false; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Converts.java b/fine-jpa/src/com/fr/third/javax/persistence/Converts.java new file mode 100644 index 000000000..e943e9e20 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Converts.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The Converts annotation is used to group Convert annotations. + * + * @since Java Persistence 2.1 + */ +@Target({METHOD, FIELD, TYPE}) +@Retention(RUNTIME) +public @interface Converts { + /** + * The Convert mappings that are to be applied to the field or property. + */ + Convert[] value(); +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorColumn.java new file mode 100644 index 000000000..aff8f582a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorColumn.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.DiscriminatorType.STRING; + +/** + * Specifies the discriminator column for the + * SINGLE_TABLE and + * JOINED {@link Inheritance} mapping strategies. + * + *

    The strategy and the discriminator column are only + * specified in the root of an entity class hierarchy or + * subhierarchy in which a different inheritance strategy is applied + * + *

    If the DiscriminatorColumn annotation is missing, + * and a discriminator column is required, the name of the + * discriminator column defaults to "DTYPE" and the discriminator + * type to {@link DiscriminatorType#STRING DiscriminatorType.STRING}. + * + *

    + *     Example:
    + *
    + *     @Entity
    + *     @Table(name="CUST")
    + *     @Inheritance(strategy=SINGLE_TABLE)
    + *     @DiscriminatorColumn(name="DISC", discriminatorType=STRING, length=20)
    + *     public class Customer { ... }
    + *
    + *     @Entity
    + *     public class ValuedCustomer extends Customer { ... }
    + * 
    + * + * @see DiscriminatorValue + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface DiscriminatorColumn { + + /** + * (Optional) The name of column to be used for the discriminator. + */ + String name() default "DTYPE"; + + /** + * (Optional) The type of object/column to use as a class discriminator. + * Defaults to {@link DiscriminatorType#STRING DiscriminatorType.STRING}. + */ + DiscriminatorType discriminatorType() default STRING; + + /** + * (Optional) The SQL fragment that is used when generating the DDL + * for the discriminator column. + *

    Defaults to the provider-generated SQL to create a column + * of the specified discriminator type. + */ + String columnDefinition() default ""; + + /** + * (Optional) The column length for String-based discriminator types. + * Ignored for other discriminator types. + */ + int length() default 31; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorType.java b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorType.java new file mode 100644 index 000000000..b6d599e4b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorType.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines supported types of the discriminator column. + * + * @since Java Persistence 1.0 + */ +public enum DiscriminatorType { + + /** + * String as the discriminator type. + */ + STRING, + + /** + * Single character as the discriminator type. + */ + CHAR, + + /** + * Integer as the discriminator type. + */ + INTEGER +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorValue.java b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorValue.java new file mode 100644 index 000000000..96498e9db --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/DiscriminatorValue.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the value of the discriminator column for + * entities of the given type. + * + *

    The DiscriminatorValue + * annotation can only be specified on a concrete entity + * class. + * + *

    If the DiscriminatorValue annotation is not + * specified and a discriminator column is used, a provider-specific + * function will be used to generate a value representing the + * entity type. If the {@link DiscriminatorType} is + * STRING, the discriminator value + * default is the entity name. + * + *

    The inheritance strategy and the discriminator column + * are only specified in the root of an entity class hierarchy + * or subhierarchy in which a different inheritance strategy is + * applied. The discriminator value, if not defaulted, should be + * specified for each entity class in the hierarchy. + * + *

    + *
    + *    Example:
    + *
    + *    @Entity
    + *    @Table(name="CUST")
    + *    @Inheritance(strategy=SINGLE_TABLE)
    + *    @DiscriminatorColumn(name="DISC", discriminatorType=STRING, length=20)
    + *    @DiscriminatorValue("CUSTOMER")
    + *    public class Customer { ... }
    + *
    + *    @Entity
    + *    @DiscriminatorValue("VCUSTOMER")
    + *    public class ValuedCustomer extends Customer { ... }
    + * 
    + * + * @see DiscriminatorColumn + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface DiscriminatorValue { + + /** + * (Optional) The value that indicates that the + * row is an entity of the annotated entity type. + * + *

    If the DiscriminatorValue annotation is not + * specified and a discriminator column is used, a + * provider-specific function will be used to generate a value + * representing the entity type. If the DiscriminatorType is + * STRING, the discriminator value default is the + * entity name. + */ + String value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ElementCollection.java b/fine-jpa/src/com/fr/third/javax/persistence/ElementCollection.java new file mode 100644 index 000000000..7ac70b3a0 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ElementCollection.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.LAZY; + +/** + * Defines a collection of instances of a basic type or embeddable + * class. + * Must be specified if the collection is to be mapped by + * means of a collection table. + * + *

    + *    Example:
    + *
    + *    @Entity public class Person {
    + *       @Id protected String ssn;
    + *       protected String name;
    + *       ...
    + *       @ElementCollection
    + *       protected Set<String> nickNames = new HashSet();
    + *         ...
    + *    }
    + *  
    + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface ElementCollection { + + /** + * (Optional) The basic or embeddable class that is the element + * type of the collection. This element is optional only if the + * collection field or property is defined using Java generics, + * and must be specified otherwise. It defaults to the + * paramterized type of the collection when defined using + * generics. + */ + Class targetClass() default void.class; + + /** + * (Optional) Whether the collection should be lazily loaded or must be + * eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the collection elements + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Embeddable.java b/fine-jpa/src/com/fr/third/javax/persistence/Embeddable.java new file mode 100644 index 000000000..2dda35a49 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Embeddable.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Defines a class whose instances are stored as an intrinsic + * part of an owning entity and share the identity of the entity. + * Each of the persistent properties or fields of the embedded + * object is mapped to the database table for the entity. + * + *

    Note that the {@link Transient} annotation may be used to + * designate the non-persistent state of an embeddable class. + * + *

    + *
    + *    Example 1:
    + *
    + *    @Embeddable public class EmploymentPeriod {
    + *       @Temporal(DATE) java.util.Date startDate;
    + *       @Temporal(DATE) java.util.Date endDate;
    + *      ...
    + *    }
    + *
    + *    Example 2:
    + *
    + *    @Embeddable public class PhoneNumber {
    + *        protected String areaCode;
    + *        protected String localNumber;
    + *        @ManyToOne PhoneServiceProvider provider;
    + *        ...
    + *     }
    + *
    + *    @Entity public class PhoneServiceProvider {
    + *        @Id protected String name;
    + *         ...
    + *     }
    + *
    + *    Example 3:
    + *
    + *    @Embeddable public class Address {
    + *       protected String street;
    + *       protected String city;
    + *       protected String state;
    + *       @Embedded protected Zipcode zipcode;
    + *    }
    + *
    + *    @Embeddable public class Zipcode {
    + *       protected String zip;
    + *       protected String plusFour;
    + *     }
    +
    +
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Documented +@Target({TYPE}) +@Retention(RUNTIME) +public @interface Embeddable { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Embedded.java b/fine-jpa/src/com/fr/third/javax/persistence/Embedded.java new file mode 100644 index 000000000..aadb05cd7 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Embedded.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a persistent field or property of an entity whose + * value is an instance of an embeddable class. The embeddable + * class must be annotated as {@link Embeddable}. + * + *

    The AttributeOverride, AttributeOverrides, + * AssociationOverride, and AssociationOverrides + * annotations may be used to override mappings declared or defaulted + * by the embeddable class. + * + *

    + *   Example:
    + *
    + *   @Embedded
    + *   @AttributeOverrides({
    + *       @AttributeOverride(name="startDate", column=@Column("EMP_START")),
    + *       @AttributeOverride(name="endDate", column=@Column("EMP_END"))
    + *   })
    + *   public EmploymentPeriod getEmploymentPeriod() { ... }
    + * 
    + * + * @see Embeddable + * @see AttributeOverride + * @see AttributeOverrides + * @see AssociationOverride + * @see AssociationOverrides + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Embedded { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EmbeddedId.java b/fine-jpa/src/com/fr/third/javax/persistence/EmbeddedId.java new file mode 100644 index 000000000..ea4da1b29 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EmbeddedId.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Applied to a persistent field or property of an entity + * class or mapped superclass to denote a composite primary + * key that is an embeddable class. The embeddable class + * must be annotated as {@link Embeddable}. + * + *

    There must be only one EmbeddedId annotation and + * no Id annotation when the EmbeddedId annotation is used. + * + *

    The {@link AttributeOverride} annotation may be used to override + * the column mappings declared within the embeddable class. + * + *

    The {@link MapsId} annotation may be used in conjunction + * with the EmbeddedId annotation to specify a derived + * primary key. + * + *

    If the entity has a derived primary key, the + * AttributeOverride annotation may only be used to + * override those attributes of the embedded id that do not correspond + * to the relationship to the parent entity. + * + *

    Relationship mappings defined within an embedded id class are not supported. + * + *

    + *    Example 1:
    + *
    + *    @EmbeddedId
    + *    protected EmployeePK empPK;
    + *
    + *
    + *    Example 2:
    + *
    + *    @Embeddable
    + *    public class DependentId {
    + *       String name;
    + *       EmployeeId empPK;   // corresponds to primary key type of Employee
    + *    }
    + *
    + *    @Entity
    + *    public class Dependent {
    + *       // default column name for "name" attribute is overridden
    + *       @AttributeOverride(name="name", @Column(name="dep_name"))
    + *       @EmbeddedId DependentId id;
    + *       ...
    + *       @MapsId("empPK")
    + *       @ManyToOne Employee emp;
    + *    }
    + * 
    + * + * @see Embeddable + * @see MapsId + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface EmbeddedId { +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Entity.java b/fine-jpa/src/com/fr/third/javax/persistence/Entity.java new file mode 100644 index 000000000..9334d331f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Entity.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that the class is an entity. This annotation is applied to the + * entity class. + * + * @since Java Persistence 1.0 + */ +@Documented +@Target(TYPE) +@Retention(RUNTIME) +public @interface Entity { + + /** + * (Optional) The entity name. Defaults to the unqualified + * name of the entity class. This name is used to refer to the + * entity in queries. The name must not be a reserved literal + * in the Java Persistence query language. + */ + String name() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityExistsException.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityExistsException.java new file mode 100644 index 000000000..410e40aab --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityExistsException.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when {@link EntityManager#persist(Object) + * EntityManager.persist(Object)} is called and the entity already exists. The + * current transaction, if one is active, will be marked for rollback. + *

    + * If the entity already exists, the EntityExistsException may be thrown when + * the persist operation is invoked, or the EntityExistsException or another + * PersistenceException may be thrown at flush or commit time. + *

    The current transaction, if one is active, will be marked for rollback. + * + * @see com.fr.third.javax.persistence.EntityManager#persist(Object) + * + * @since Java Persistence 1.0 + */ +public class EntityExistsException extends PersistenceException { + + /** + * Constructs a new EntityExistsException exception with + * null as its detail message. + */ + public EntityExistsException() { + super(); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public EntityExistsException(String message) { + super(message); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified detail message and cause. + * + * @param message + * the detail message. + * @param cause + * the cause. + */ + public EntityExistsException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new EntityExistsException exception with the + * specified cause. + * + * @param cause + * the cause. + */ + public EntityExistsException(Throwable cause) { + super(cause); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityGraph.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityGraph.java new file mode 100644 index 000000000..8db742551 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityGraph.java @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import com.fr.third.javax.persistence.metamodel.Attribute; +import java.util.List; + +/** + * This type represents the root of an entity graph that will be used as a template to define the attribute nodes + * and boundaries of a graph of entities and entity relationships. The root must be an entity type. + * + * The methods to add subgraphs implicitly create the corresponding attribute nodes as well; such attribute nodes + * should not be redundantly specified. + * + * @param The type of the root entity. + * + * @since JPA 2.1 + */ +public interface EntityGraph { + /** + * Return the name of a named EntityGraph - an entity graph defined by means of the NamedEntityGraph annotation, + * XML descriptor element, or added by means of the addNamedEntityGraph method. Returns null if the EntityGraph + * is not a named EntityGraph. + */ + public String getName(); + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attributeName name of the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public void addAttributeNodes(String... attributeName); + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attribute attribute + * + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public void addAttributeNodes(Attribute... attribute); + + /** + * Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node + * entity graphs that include related managed types. + * + * @param attribute attribute + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public Subgraph addSubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs + * + * @param attribute attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public Subgraph addSubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node + * entity graphs that include related managed types. + * + * @param attributeName name of the attribute + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public Subgraph addSubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs. + * + * @param attributeName name of the attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addSubgraph(String attributeName, Class type); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. Use of this method implicitly adds the + * corresponding attribute node to the graph. + * + * @param attribute attribute + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute's target type is not an entity + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include + * the specified attributes of superclass subgraphs. + * + * @param attribute attribute + * @param type entity subclass + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute's target type is not an entity + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. + * + * @param attributeName name of the attribute + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type is not an entity + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related managed types. Subclass subgraphs will + * automatically include the specified attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(String attributeName, Class type); + + /** + * Add additional attributes to this entity graph that correspond to attributes of subclasses of this EntityGraph's + * entity type. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs. + * + * @param type entity subclass + * + * @return subgraph for the subclass + * + * @throws IllegalArgumentException if the type is not an entity type + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public Subgraph addSubclassSubgraph(Class type); + + /** + * Return the attribute nodes of this entity that are included + * in the entity graph. + * + * @return attribute nodes for the annotated entity type + */ + public List> getAttributeNodes(); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityListeners.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityListeners.java new file mode 100644 index 000000000..680055d76 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityListeners.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the callback listener classes to be used for an + * entity or mapped superclass. This annotation may be applied + * to an entity class or mapped superclass. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface EntityListeners { + + /** The callback listener classes */ + Class[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityManager.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityManager.java new file mode 100644 index 000000000..a269a743e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityManager.java @@ -0,0 +1,881 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import com.fr.third.javax.persistence.criteria.CriteriaBuilder; +import com.fr.third.javax.persistence.criteria.CriteriaDelete; +import com.fr.third.javax.persistence.criteria.CriteriaQuery; +import com.fr.third.javax.persistence.criteria.CriteriaUpdate; +import com.fr.third.javax.persistence.metamodel.Metamodel; +import java.util.List; +import java.util.Map; + +/** + * Interface used to interact with the persistence context. + * + *

    An EntityManager instance is associated with + * a persistence context. A persistence context is a set of entity + * instances in which for any persistent entity identity there is + * a unique entity instance. Within the persistence context, the + * entity instances and their lifecycle are managed. + * The EntityManager API is used + * to create and remove persistent entity instances, to find entities + * by their primary key, and to query over entities. + * + *

    The set of entities that can be managed by a given + * EntityManager instance is defined by a persistence + * unit. A persistence unit defines the set of all classes that are + * related or grouped by the application, and which must be + * colocated in their mapping to a single database. + * + * @see Query + * @see TypedQuery + * @see CriteriaQuery + * @see PersistenceContext + * + * @since Java Persistence 1.0 + */ +public interface EntityManager { + + /** + * Make an instance managed and persistent. + * @param entity entity instance + * @throws EntityExistsException if the entity already exists. + * (If the entity already exists, the EntityExistsException may + * be thrown when the persist operation is invoked, or the + * EntityExistsException or another PersistenceException may be + * thrown at flush or commit time.) + * @throws IllegalArgumentException if the instance is not an + * entity + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + */ + public void persist(Object entity); + + /** + * Merge the state of the given entity into the + * current persistence context. + * @param entity entity instance + * @return the managed instance that the state was merged to + * @throws IllegalArgumentException if instance is not an + * entity or is a removed entity + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + */ + public T merge(T entity); + + /** + * Remove the entity instance. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + */ + public void remove(Object entity); + + /** + * Find by primary key. + * Search for an entity of the specified class and primary key. + * If the entity instance is contained in the persistence context, + * it is returned from there. + * @param entityClass entity class + * @param primaryKey primary key + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * is not a valid type for that entity’s primary key or + * is null + */ + public T find(Class entityClass, Object primaryKey); + + /** + * Find by primary key, using the specified properties. + * Search for an entity of the specified class and primary key. + * If the entity instance is contained in the persistence + * context, it is returned from there. + * If a vendor-specific property or hint is not recognized, + * it is silently ignored. + * @param entityClass entity class + * @param primaryKey primary key + * @param properties standard and vendor-specific properties + * and hints + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * is not a valid type for that entity’s primary key or + * is null + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + Map properties); + + /** + * Find by primary key and lock. + * Search for an entity of the specified class and primary key + * and lock it with respect to the specified lock type. + * If the entity instance is contained in the persistence context, + * it is returned from there, and the effect of this method is + * the same as if the lock method had been called on the entity. + *

    If the entity is found within the persistence context and the + * lock mode type is pessimistic and the entity has a version + * attribute, the persistence provider must perform optimistic + * version checks when obtaining the database lock. If these + * checks fail, the OptimisticLockException will be thrown. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
    + * @param entityClass entity class + * @param primaryKey primary key + * @param lockMode lock mode + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity's primary key or + * is null + * @throws TransactionRequiredException if there is no + * transaction and a lock mode other than NONE is + * specified + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + LockModeType lockMode); + + /** + * Find by primary key and lock, using the specified properties. + * Search for an entity of the specified class and primary key + * and lock it with respect to the specified lock type. + * If the entity instance is contained in the persistence context, + * it is returned from there. + *

    If the entity is found + * within the persistence context and the lock mode type + * is pessimistic and the entity has a version attribute, the + * persistence provider must perform optimistic version checks + * when obtaining the database lock. If these checks fail, + * the OptimisticLockException will be thrown. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
    + *

    If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

    Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entityClass entity class + * @param primaryKey primary key + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @return the found entity instance or null if the entity does + * not exist + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity's primary key or + * is null + * @throws TransactionRequiredException if there is no + * transaction and a lock mode other than NONE is + * specified + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public T find(Class entityClass, Object primaryKey, + LockModeType lockMode, + Map properties); + + /** + * Get an instance, whose state may be lazily fetched. + * If the requested instance does not exist in the database, + * the EntityNotFoundException is thrown when the instance + * state is first accessed. (The persistence provider runtime is + * permitted to throw the EntityNotFoundException when + * getReference is called.) + * The application should not expect that the instance state will + * be available upon detachment, unless it was accessed by the + * application while the entity manager was open. + * @param entityClass entity class + * @param primaryKey primary key + * @return the found entity instance + * @throws IllegalArgumentException if the first argument does + * not denote an entity type or the second argument is + * not a valid type for that entity’s primary key or + * is null + * @throws EntityNotFoundException if the entity state + * cannot be accessed + */ + public T getReference(Class entityClass, + Object primaryKey); + + /** + * Synchronize the persistence context to the + * underlying database. + * @throws TransactionRequiredException if there is + * no transaction + * @throws PersistenceException if the flush fails + */ + public void flush(); + + /** + * Set the flush mode that applies to all objects contained + * in the persistence context. + * @param flushMode flush mode + */ + public void setFlushMode(FlushModeType flushMode); + + /** + * Get the flush mode that applies to all objects contained + * in the persistence context. + * @return flushMode + */ + public FlushModeType getFlushMode(); + + /** + * Lock an entity instance that is contained in the persistence + * context with the specified lock mode type. + *

    If a pessimistic lock mode type is specified and the entity + * contains a version attribute, the persistence provider must + * also perform optimistic version checks when obtaining the + * database lock. If these checks fail, the + * OptimisticLockException will be thrown. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
    + * @param entity entity instance + * @param lockMode lock mode + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if there is no + * transaction + * @throws EntityNotFoundException if the entity does not exist + * in the database when pessimistic locking is + * performed + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + */ + public void lock(Object entity, LockModeType lockMode); + + /** + * Lock an entity instance that is contained in the persistence + * context with the specified lock mode type and with specified + * properties. + *

    If a pessimistic lock mode type is specified and the entity + * contains a version attribute, the persistence provider must + * also perform optimistic version checks when obtaining the + * database lock. If these checks fail, the + * OptimisticLockException will be thrown. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
    + *

    If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

    Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entity entity instance + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not an + * entity or is a detached entity + * @throws TransactionRequiredException if there is no + * transaction + * @throws EntityNotFoundException if the entity does not exist + * in the database when pessimistic locking is + * performed + * @throws OptimisticLockException if the optimistic version + * check fails + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void lock(Object entity, LockModeType lockMode, + Map properties); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + * @throws EntityNotFoundException if the entity no longer + * exists in the database + */ + public void refresh(Object entity); + + /** + * Refresh the state of the instance from the database, using + * the specified properties, and overwriting changes made to + * the entity, if any. + *

    If a vendor-specific property or hint is not recognized, + * it is silently ignored. + * @param entity entity instance + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if invoked on a + * container-managed entity manager of type + * PersistenceContextType.TRANSACTION and there is + * no transaction + * @throws EntityNotFoundException if the entity no longer + * exists in the database + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, + Map properties); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any, and + * lock it with respect to given lock mode type. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the + * database locking failure causes only statement-level + * rollback. + *
    + * @param entity entity instance + * @param lockMode lock mode + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if there is no + * transaction and if invoked on a container-managed + * EntityManager instance with + * PersistenceContextType.TRANSACTION or with a lock mode + * other than NONE + * @throws EntityNotFoundException if the entity no longer exists + * in the database + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, LockModeType lockMode); + + /** + * Refresh the state of the instance from the database, + * overwriting changes made to the entity, if any, and + * lock it with respect to given lock mode type and with + * specified properties. + *

    If the lock mode type is pessimistic and the entity instance + * is found but cannot be locked: + *

      + *
    • the PessimisticLockException will be thrown if the database + * locking failure causes transaction-level rollback + *
    • the LockTimeoutException will be thrown if the database + * locking failure causes only statement-level rollback + *
    + *

    If a vendor-specific property or hint is not recognized, + * it is silently ignored. + *

    Portable applications should not rely on the standard timeout + * hint. Depending on the database in use and the locking + * mechanisms used by the provider, the hint may or may not + * be observed. + * @param entity entity instance + * @param lockMode lock mode + * @param properties standard and vendor-specific properties + * and hints + * @throws IllegalArgumentException if the instance is not + * an entity or the entity is not managed + * @throws TransactionRequiredException if there is no + * transaction and if invoked on a container-managed + * EntityManager instance with + * PersistenceContextType.TRANSACTION or with a lock mode + * other than NONE + * @throws EntityNotFoundException if the entity no longer exists + * in the database + * @throws PessimisticLockException if pessimistic locking fails + * and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking fails and + * only the statement is rolled back + * @throws PersistenceException if an unsupported lock call + * is made + * @since Java Persistence 2.0 + */ + public void refresh(Object entity, LockModeType lockMode, + Map properties); + + /** + * Clear the persistence context, causing all managed + * entities to become detached. Changes made to entities that + * have not been flushed to the database will not be + * persisted. + */ + public void clear(); + + /** + * Remove the given entity from the persistence context, causing + * a managed entity to become detached. Unflushed changes made + * to the entity if any (including removal of the entity), + * will not be synchronized to the database. Entities which + * previously referenced the detached entity will continue to + * reference it. + * @param entity entity instance + * @throws IllegalArgumentException if the instance is not an + * entity + * @since Java Persistence 2.0 + */ + public void detach(Object entity); + + /** + * Check if the instance is a managed entity instance belonging + * to the current persistence context. + * @param entity entity instance + * @return boolean indicating if entity is in persistence context + * @throws IllegalArgumentException if not an entity + */ + public boolean contains(Object entity); + + /** + * Get the current lock mode for the entity instance. + * @param entity entity instance + * @return lock mode + * @throws TransactionRequiredException if there is no + * transaction + * @throws IllegalArgumentException if the instance is not a + * managed entity and a transaction is active + * @since Java Persistence 2.0 + */ + public LockModeType getLockMode(Object entity); + + /** + * Set an entity manager property or hint. + * If a vendor-specific property or hint is not recognized, it is + * silently ignored. + * @param propertyName name of property or hint + * @param value value for property or hint + * @throws IllegalArgumentException if the second argument is + * not valid for the implementation + * @since Java Persistence 2.0 + */ + public void setProperty(String propertyName, Object value); + + /** + * Get the properties and hints and associated values that are in effect + * for the entity manager. Changing the contents of the map does + * not change the configuration in effect. + * @return map of properties and hints in effect for entity manager + * @since Java Persistence 2.0 + */ + public Map getProperties(); + + /** + * Create an instance of Query for executing a + * Java Persistence query language statement. + * @param qlString a Java Persistence query string + * @return the new query instance + * @throws IllegalArgumentException if the query string is + * found to be invalid + */ + public Query createQuery(String qlString); + + /** + * Create an instance of TypedQuery for executing a + * criteria query. + * @param criteriaQuery a criteria query object + * @return the new query instance + * @throws IllegalArgumentException if the criteria query is + * found to be invalid + * @since Java Persistence 2.0 + */ + public TypedQuery createQuery(CriteriaQuery criteriaQuery); + + /** + * Create an instance of Query for executing a criteria + * update query. + * + * @param updateQuery a criteria update query object + * @return the new query instance + * @throws IllegalArgumentException if the update query is found to be invalid + */ + public Query createQuery(CriteriaUpdate updateQuery); + + /** + * Create an instance of Query for executing a criteria + * delete query. + * @param deleteQuery a criteria delete query object + * @return the new query instance + * @throws IllegalArgumentException if the delete query isfound to be invalid + */ + public Query createQuery(CriteriaDelete deleteQuery); + + /** + * Create an instance of TypedQuery for executing a + * Java Persistence query language statement. + * The select list of the query must contain only a single + * item, which must be assignable to the type specified by + * the resultClass argument. + * @param qlString a Java Persistence query string + * @param resultClass the type of the query result + * @return the new query instance + * @throws IllegalArgumentException if the query string is found + * to be invalid or if the query result is found to + * not be assignable to the specified type + * @since Java Persistence 2.0 + */ + public TypedQuery createQuery(String qlString, Class resultClass); + + /** + * Create an instance of Query for executing a named query + * (in the Java Persistence query language or in native SQL). + * @param name the name of a query defined in metadata + * @return the new query instance + * @throws IllegalArgumentException if a query has not been + * defined with the given name or if the query string is + * found to be invalid + */ + public Query createNamedQuery(String name); + + /** + * Create an instance of TypedQuery for executing a + * Java Persistence query language named query. + * The select list of the query must contain only a single + * item, which must be assignable to the type specified by + * the resultClass argument. + * @param name the name of a query defined in metadata + * @param resultClass the type of the query result + * @return the new query instance + * @throws IllegalArgumentException if a query has not been + * defined with the given name or if the query string is + * found to be invalid or if the query result is found to + * not be assignable to the specified type + * @since Java Persistence 2.0 + */ + public TypedQuery createNamedQuery(String name, Class resultClass); + + /** + * Create an instance of Query for executing + * a native SQL statement, e.g., for update or delete. + * @param sqlString a native SQL query string + * @return the new query instance + */ + public Query createNativeQuery(String sqlString); + + /** + * Create an instance of Query for executing + * a native SQL query. + * @param sqlString a native SQL query string + * @param resultClass the class of the resulting instance(s) + * @return the new query instance + */ + public Query createNativeQuery(String sqlString, Class resultClass); + + /** + * Create an instance of Query for executing + * a native SQL query. + * @param sqlString a native SQL query string + * @param resultSetMapping the name of the result set mapping + * @return the new query instance + */ + public Query createNativeQuery(String sqlString, String resultSetMapping); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + * + * @param name name assigned to the stored procedure query + * in metadata + * + * @return the new stored procedure query instance + * + * @throws IllegalArgumentException if a query has not been + * defined with the given name + */ + public StoredProcedureQuery createNamedStoredProcedureQuery( + String name); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + * Parameters must be registered before the stored procedure can + * be executed. + * If the stored procedure returns one or more result sets, + * any result set will be returned as a list of type Object[]. + * + * @param procedureName name of the stored procedure in the + * database + * + * @return the new stored procedure query instance + * + * @throws IllegalArgumentException if a stored procedure of the + * given name does not exist (or the query execution + * will fail) + */ + public StoredProcedureQuery createStoredProcedureQuery( + String procedureName); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + * Parameters must be registered before the stored procedure can + * be executed. + * The resultClass arguments must be specified in the order in + * which the result sets will be returned by the stored procedure + * invocation. + * + * @param procedureName name of the stored procedure in the + * database + * @param resultClasses classes to which the result sets + * produced by the stored procedure are to + * be mapped + * + * @return the new stored procedure query instance + * + * @throws IllegalArgumentException if a stored procedure of the + * given name does not exist (or the query execution + * will fail) + */ + public StoredProcedureQuery createStoredProcedureQuery( + String procedureName, Class... resultClasses); + + /** + * Create an instance of StoredProcedureQuery for executing a + * stored procedure in the database. + * Parameters must be registered before the stored procedure can + * be executed. + * The resultSetMapping arguments must be specified in the order + * in which the result sets will be returned by the stored + * procedure invocation. + * + * @param procedureName name of the stored procedure in the + * database + * @param resultSetMappings the names of the result set mappings + * to be used in mapping result sets + * returned by the stored procedure + * + * @return the new stored procedure query instance + * + * @throws IllegalArgumentException if a stored procedure or + * result set mapping of the given name does not exist + * (or the query execution will fail) + */ + public StoredProcedureQuery createStoredProcedureQuery( + String procedureName, String... resultSetMappings); + + /** + * Indicate to the entity manager that a JTA transaction is + * active. This method should be called on a JTA application + * managed entity manager that was created outside the scope + * of the active transaction to associate it with the current + * JTA transaction. + * @throws TransactionRequiredException if there is + * no transaction + */ + public void joinTransaction(); + + /** + * Determine whether the entity manager is joined to the + * current transaction. Returns false if the entity manager + * is not joined to the current transaction or if no + * transaction is active + * @return boolean + */ + public boolean isJoinedToTransaction(); + + /** + * Return an object of the specified type to allow access to the + * provider-specific API. If the provider's EntityManager + * implementation does not support the specified class, the + * PersistenceException is thrown. + * @param cls the class of the object to be returned. This is + * normally either the underlying EntityManager implementation + * class or an interface that it implements. + * @return an instance of the specified class + * @throws PersistenceException if the provider does not + * support the call + * @since Java Persistence 2.0 + */ + public T unwrap(Class cls); + + /** + * Return the underlying provider object for the EntityManager, + * if available. The result of this method is implementation + * specific. The unwrap method is to be preferred for new + * applications. + * @return underlying provider object for EntityManager + */ + public Object getDelegate(); + + /** + * Close an application-managed entity manager. + * After the close method has been invoked, all methods + * on the EntityManager instance and any + * Query and TypedQuery + * objects obtained from it will throw the IllegalStateException + * except for getProperties, + * getTransaction, and isOpen (which will return false). + * If this method is called when the entity manager is + * associated with an active transaction, the persistence + * context remains managed until the transaction completes. + * @throws IllegalStateException if the entity manager + * is container-managed + */ + public void close(); + + /** + * Determine whether the entity manager is open. + * @return true until the entity manager has been closed + */ + public boolean isOpen(); + + /** + * Return the resource-level EntityTransaction object. + * The EntityTransaction instance may be used serially to + * begin and commit multiple transactions. + * @return EntityTransaction instance + * @throws IllegalStateException if invoked on a JTA + * entity manager + */ + public EntityTransaction getTransaction(); + + /** + * Return the entity manager factory for the entity manager. + * @return EntityManagerFactory instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public EntityManagerFactory getEntityManagerFactory(); + + /** + * Return an instance of CriteriaBuilder for the creation of + * CriteriaQuery objects. + * @return CriteriaBuilder instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public CriteriaBuilder getCriteriaBuilder(); + + /** + * Return an instance of Metamodel interface for access to the + * metamodel of the persistence unit. + * @return Metamodel instance + * @throws IllegalStateException if the entity manager has + * been closed + * @since Java Persistence 2.0 + */ + public Metamodel getMetamodel(); + + /** + * Return a mutable EntityGraph that can be used to dynamically create an EntityGraph. + * + * @param rootType class of entity graph + * + * @return entity graph + * + * @since JPA 2.1 + */ + public EntityGraph createEntityGraph(Class rootType); + + /** + * Return a mutable copy of the named EntityGraph. If there is no entity graph with the specified name, null + * is returned. + * + * @param graphName name of an entity graph + * + * @return entity graph + * + * @since JPA 2.1 + */ + public EntityGraph createEntityGraph(String graphName); + + /** + * Return a named EntityGraph. The returned EntityGraph should be considered immutable. + * + * @param graphName name of an existing entity graph + * + * @return named entity graph + * + * @throws IllegalArgumentException if there is no EntityGraph of the given name + * + * @since JPA 2.1 + */ + public EntityGraph getEntityGraph(String graphName); + + /** + * Return all named EntityGraphs that have been defined for the provided class type. + * + * @param entityClass entity class + * + * @return list of all entity graphs defined for the entity + * + * @throws IllegalArgumentException if the class is not an entity + * + * @since JPA 2.1 + */ + public List> getEntityGraphs(Class entityClass); + +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityManagerFactory.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityManagerFactory.java new file mode 100644 index 000000000..3b961b485 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityManagerFactory.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import com.fr.third.javax.persistence.criteria.CriteriaBuilder; +import com.fr.third.javax.persistence.metamodel.Metamodel; +import java.util.Map; + +/** + * Interface used to interact with the entity manager factory + * for the persistence unit. + * + *

    When the application has finished using the entity manager + * factory, and/or at application shutdown, the application should + * close the entity manager factory. Once an + * EntityManagerFactory has been closed, all its entity managers + * are considered to be in the closed state. + * + * @since Java Persistence 1.0 + */ +public interface EntityManagerFactory { + + /** + * Create a new application-managed EntityManager. This method returns a new + * code>EntityManager instance each time it is invoked. The isOpen method will return true + * on the returned instance. + * + * @return entity manager instance + * + * @throws IllegalStateException if the entity manager factory has been closed + */ + public EntityManager createEntityManager(); + + /** + * Create a new application-managed EntityManager with the + * specified Map of properties. This method returns a new EntityManager instance each time + * it is invoked. The isOpen method will return true on the returned instance. + * + * @param map properties for entity manager + * + * @return entity manager instance + * + * @throws IllegalStateException if the entity manager factory + * has been closed + */ + public EntityManager createEntityManager(Map map); + + /** + * Create a new JTA application-managed EntityManager with the specified synchronization type. This method + * returns a new EntityManager instance each time it is invoked. The isOpen method will return true on the + * returned instance. + * + * @param synchronizationType how and when the entity manager should be synchronized with the current JTA + * transaction + * + * @return entity manager instance + * + * @throws IllegalStateException if the entity manager factory has been configured for resource-local entity + * managers or has been closed + */ + public EntityManager createEntityManager(SynchronizationType synchronizationType); + + /** + * Create a new JTA application-managed EntityManager with the specified synchronization type and Map of properties. + * This method returns a new EntityManager instance each time it is invoked. The isOpen method will return true + * on the returned instance. + * + * @param synchronizationType how and when the entity manager + * should be synchronized with the current JTA transaction + * @param map properties for entity manager; may be null + * + * @return entity manager instance + * + * @throws IllegalStateException if the entity manager factory has been configured for resource-local entity + * managers or has been closed + */ + public EntityManager createEntityManager(SynchronizationType synchronizationType, Map map); + + /** + * Return an instance of CriteriaBuilder for the creation of + * CriteriaQuery objects. + * @return CriteriaBuilder instance + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public CriteriaBuilder getCriteriaBuilder(); + + /** + * Return an instance of Metamodel interface for access to the + * metamodel of the persistence unit. + * @return Metamodel instance + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Metamodel getMetamodel(); + + /** + * Indicates whether the factory is open. Returns true + * until the factory has been closed. + * @return boolean indicating whether the factory is open + */ + public boolean isOpen(); + + /** + * Close the factory, releasing any resources that it holds. + * After a factory instance has been closed, all methods invoked + * on it will throw the IllegalStateException, except + * for isOpen, which will return false. Once an + * EntityManagerFactory has been closed, all its + * entity managers are considered to be in the closed state. + * @throws IllegalStateException if the entity manager factory + * has been closed + */ + public void close(); + + /** + * Get the properties and associated values that are in effect + * for the entity manager factory. Changing the contents of the + * map does not change the configuration in effect. + * @return properties + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Map getProperties(); + + /** + * Access the cache that is associated with the entity manager + * factory (the "second level cache"). + * @return instance of the Cache interface + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public Cache getCache(); + + /** + * Return interface providing access to utility methods + * for the persistence unit. + * @return PersistenceUnitUtil interface + * @throws IllegalStateException if the entity manager factory + * has been closed + * + * @since Java Persistence 2.0 + */ + public PersistenceUnitUtil getPersistenceUnitUtil(); + + /** + * Define the query, typed query, or stored procedure query as + * a named query such that future query objects can be created + * from it using the createNamedQuery methods. + * Any configuration of the query object (except for actual + * parameter binding) in effect when the named query is added + * is retained as part of the named query definition. + * This includes configuration information such as max results, + * hints, flush mode, lock mode, result set mapping information, + * and information about stored procedure parameters. + * When the query is executed, information that can be set + * by means of the Query API can be overridden. Information + * that is overridden does not affect the named query as + * registered with the entity manager factory, and thus does + * not affect subsequent query objects created from it by + * means of the createNamedQuery method. + * If a named query of the same name has been previously + * defined, either statically via metadata or via this method, + * that query definition is replaced. + * + * @param name name for the query + * @param query Query, TypedQuery, or StoredProcedureQuery object + * + * @since Java Persistence 2.1 + */ + public void addNamedQuery(String name, Query query); + + /** + * Return an object of the specified type to allow access to the + * provider-specific API. If the provider's EntityManagerFactory + * implementation does not support the specified class, the + * PersistenceException is thrown. + * + * @param cls the class of the object to be returned. This is + * normally either the underlying EntityManagerFactory + * implementation class or an interface that it implements. + * + * @return an instance of the specified class + * + * @throws PersistenceException if the provider does not + * support the call + */ + public T unwrap(Class cls); + + /** + * Add a named copy of the EntityGraph to the + * EntityManagerFactory. If an entity graph with the same name + * already exists, it is replaced. + * + * @param graphName name for the entity graph + * @param entityGraph entity graph + * + * @since JPA 2.1 + */ + public void addNamedEntityGraph(String graphName, EntityGraph entityGraph); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityNotFoundException.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityNotFoundException.java new file mode 100644 index 000000000..e52140ec2 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityNotFoundException.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when an entity reference obtained by + * {@link EntityManager#getReference EntityManager.getReference} + * is accessed but the entity does not exist. Thrown when + * {@link EntityManager#refresh EntityManager.refresh} is called and the + * object no longer exists in the database. + * Thrown when {@link EntityManager#lock EntityManager.lock} is used with + * pessimistic locking is used and the entity no longer exists in the database. + *

    The current transaction, if one is active, will be marked for rollback. + * + * @see EntityManager#getReference(Class,Object) + * @see EntityManager#refresh(Object) + * @see EntityManager#refresh(Object, LockModeType) + * @see EntityManager#refresh(Object, java.util.Map) + * @see EntityManager#refresh(Object, LockModeType, java.util.Map) + * @see EntityManager#lock(Object, LockModeType) + * @see EntityManager#lock(Object, LockModeType, java.util.Map) + * + * @since Java Persistence 1.0 + */ +public class EntityNotFoundException extends PersistenceException { + + /** + * Constructs a new EntityNotFoundException exception with + * null as its detail message. + */ + public EntityNotFoundException() { + super(); + } + + /** + * Constructs a new EntityNotFoundException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public EntityNotFoundException(String message) { + super(message); + } + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityResult.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityResult.java new file mode 100644 index 000000000..b8fe97c7e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityResult.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to map the SELECT clause of a SQL query to an entity result. + * If this annotation is used, the SQL statement should select + * all of the columns that are mapped to the entity object. + * This should include foreign key columns to related entities. + * The results obtained when insufficient data is available + * are undefined. + * + *

    + *   Example:
    + *
    + *   Query q = em.createNativeQuery(
    + *       "SELECT o.id, o.quantity, o.item, i.id, i.name, i.description "+
    + *           "FROM Order o, Item i " +
    + *           "WHERE (o.quantity > 25) AND (o.item = i.id)",
    + *       "OrderItemResults");
    + *   @SqlResultSetMapping(name="OrderItemResults",
    + *       entities={
    + *           @EntityResult(entityClass=com.acme.Order.class),
    + *           @EntityResult(entityClass=com.acme.Item.class)
    + *   })
    + * 
    + * + * @see SqlResultSetMapping + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) +public @interface EntityResult { + + /** The class of the result. */ + Class entityClass(); + + /** + * Maps the columns specified in the SELECT list of the + * query to the properties or fields of the entity class. + */ + FieldResult[] fields() default {}; + + /** + * Specifies the column name (or alias) of the column in + * the SELECT list that is used to determine the type of + * the entity instance. + */ + String discriminatorColumn() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EntityTransaction.java b/fine-jpa/src/com/fr/third/javax/persistence/EntityTransaction.java new file mode 100644 index 000000000..6566265da --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EntityTransaction.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Interface used to control transactions on resource-local entity + * managers. The {@link EntityManager#getTransaction + * EntityManager.getTransaction()} method returns the + * EntityTransaction interface. + * + * @since Java Persistence 1.0 + */ +public interface EntityTransaction { + + /** + * Start a resource transaction. + * @throws IllegalStateException if isActive() is true + */ + public void begin(); + + /** + * Commit the current resource transaction, writing any + * unflushed changes to the database. + * @throws IllegalStateException if isActive() is false + * @throws RollbackException if the commit fails + */ + public void commit(); + + /** + * Roll back the current resource transaction. + * @throws IllegalStateException if isActive() is false + * @throws PersistenceException if an unexpected error + * condition is encountered + */ + public void rollback(); + + /** + * Mark the current resource transaction so that the only + * possible outcome of the transaction is for the transaction + * to be rolled back. + * @throws IllegalStateException if isActive() is false + */ + public void setRollbackOnly(); + + /** + * Determine whether the current resource transaction has been + * marked for rollback. + * @return boolean indicating whether the transaction has been + * marked for rollback + * @throws IllegalStateException if isActive() is false + */ + public boolean getRollbackOnly(); + + /** + * Indicate whether a resource transaction is in progress. + * @return boolean indicating whether transaction is + * in progress + * @throws PersistenceException if an unexpected error + * condition is encountered + */ + public boolean isActive(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/EnumType.java b/fine-jpa/src/com/fr/third/javax/persistence/EnumType.java new file mode 100644 index 000000000..f7aa8efe3 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/EnumType.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines mapping for enumerated types. The constants of this + * enumerated type specify how a persistent property or + * field of an enumerated type should be persisted. + * + * @since Java Persistence 1.0 + */ +public enum EnumType { + /** Persist enumerated type property or field as an integer. */ + ORDINAL, + + /** Persist enumerated type property or field as a string. */ + STRING +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Enumerated.java b/fine-jpa/src/com/fr/third/javax/persistence/Enumerated.java new file mode 100644 index 000000000..aa2350032 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Enumerated.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.EnumType.ORDINAL; + +/** + * Specifies that a persistent property or field should be persisted + * as a enumerated type. The Enumerated annotation may + * be used in conjunction with the Basic annotation, or in + * conjunction with the ElementCollection annotation when the + * element collection value is of basic type. If the enumerated type + * is not specified or the Enumerated annotation is not + * used, the EnumType value is assumed to be ORDINAL. + * + *
    + *   Example:
    + *
    + *   public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
    + *
    + *   public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
    + *
    + *   @Entity public class Employee {
    + *       public EmployeeStatus getStatus() {...}
    + *       ...
    + *       @Enumerated(STRING)
    + *       public SalaryRate getPayScale() {...}
    + *       ...
    + *   }
    + * 
    + * + * @see Basic + * @see ElementCollection + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Enumerated { + + /** (Optional) The type used in mapping an enum type. */ + EnumType value() default ORDINAL; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ExcludeDefaultListeners.java b/fine-jpa/src/com/fr/third/javax/persistence/ExcludeDefaultListeners.java new file mode 100644 index 000000000..e1a42d9a1 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ExcludeDefaultListeners.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that the invocation of default listeners is + * to be excluded for the entity class (or mapped superclass) + * and its subclasses. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface ExcludeDefaultListeners { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ExcludeSuperclassListeners.java b/fine-jpa/src/com/fr/third/javax/persistence/ExcludeSuperclassListeners.java new file mode 100644 index 000000000..056916800 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ExcludeSuperclassListeners.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that the invocation of superclass listeners is + * to be excluded for the entity class (or mapped superclass) + * and its subclasses. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface ExcludeSuperclassListeners { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/FetchType.java b/fine-jpa/src/com/fr/third/javax/persistence/FetchType.java new file mode 100644 index 000000000..f32250ca6 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/FetchType.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines strategies for fetching data from the database. + * The EAGER strategy is a requirement on the persistence + * provider runtime that data must be eagerly fetched. The + * LAZY strategy is a hint to the persistence provider + * runtime that data should be fetched lazily when it is + * first accessed. The implementation is permitted to eagerly + * fetch data for which the LAZY strategy hint has been + * specified. + * + *
    + *   Example:
    + *   @Basic(fetch=LAZY)
    + *   protected String getName() { return name; }
    + * 
    + * + * @see Basic + * @see ElementCollection + * @see ManyToMany + * @see OneToMany + * @see ManyToOne + * @see OneToOne + * @since Java Persistence 1.0 + */ +public enum FetchType { + + /** Defines that data can be lazily fetched. */ + LAZY, + + /** Defines that data must be eagerly fetched. */ + EAGER +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/FieldResult.java b/fine-jpa/src/com/fr/third/javax/persistence/FieldResult.java new file mode 100644 index 000000000..cdcbb0086 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/FieldResult.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to map the columns specified in the SELECT list + * of the query to the properties or fields of the entity class. + * + *
    + *
    + * Example:
    + *   Query q = em.createNativeQuery(
    + *       "SELECT o.id AS order_id, " +
    + *           "o.quantity AS order_quantity, " +
    + *           "o.item AS order_item, " +
    + *         "FROM Order o, Item i " +
    + *         "WHERE (order_quantity > 25) AND (order_item = i.id)",
    + *       "OrderResults");
    + *
    + *   @SqlResultSetMapping(name="OrderResults",
    + *       entities={
    + *           @EntityResult(entityClass=com.acme.Order.class, fields={
    + *               @FieldResult(name="id", column="order_id"),
    + *               @FieldResult(name="quantity", column="order_quantity"),
    + *               @FieldResult(name="item", column="order_item")})
    + *       })
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({}) +@Retention(RUNTIME) + +public @interface FieldResult { + + /** Name of the persistent field or property of the class. */ + String name(); + + /** + * Name of the column in the SELECT clause - i.e., column + * aliases, if applicable. + */ + String column(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/FlushModeType.java b/fine-jpa/src/com/fr/third/javax/persistence/FlushModeType.java new file mode 100644 index 000000000..15945b1f5 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/FlushModeType.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Flush mode setting. + * + *

    When queries are executed within a transaction, if + * FlushModeType.AUTO is set on the {@link + * com.fr.third.javax.persistence.Query Query} or {@link com.fr.third.javax.persistence.TypedQuery + * TypedQuery} object, or if the flush mode setting for the + * persistence context is AUTO (the default) and a flush + * mode setting has not been specified for the Query or + * TypedQuery object, the persistence provider is + * responsible for ensuring that all updates to the state of all + * entities in the persistence context which could potentially affect + * the result of the query are visible to the processing of the + * query. The persistence provider implementation may achieve this by + * flushing those entities to the database or by some other means. + *

    If FlushModeType.COMMIT is set, the effect of + * updates made to entities in the persistence context upon queries is + * unspecified. + * + *

    If there is no transaction active, the persistence provider + * must not flush to the database. + * + * @since Java Persistence 1.0 + */ +public enum FlushModeType { + + /** Flushing to occur at transaction commit. The provider may flush + * at other times, but is not required to. + */ + COMMIT, + + /** (Default) Flushing to occur at query execution. */ + AUTO +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ForeignKey.java b/fine-jpa/src/com/fr/third/javax/persistence/ForeignKey.java new file mode 100644 index 000000000..b932121db --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ForeignKey.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The ForeignKey annotation is used in schema generation. It is used to define a foreign key constraint or to + * override or disable the persistence provider’s default foreign key definition. + * + * @since JPA 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface ForeignKey { + /** + * (Optional) The name of the foreign key constraint. Defaults to a provider-generated name. + * + * @return The foreign key name + */ + String name() default ""; + + /** + * (Optional) The foreign key constraint definition. Default is provider defined. If the value of + * disableForeignKey is true, the provider must not generate a foreign key constraint. + * + * @return The foreign key definition + */ + String foreignKeyDefinition() default ""; + + /** + * (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect. + */ + ConstraintMode value() default ConstraintMode.CONSTRAINT; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/GeneratedValue.java b/fine-jpa/src/com/fr/third/javax/persistence/GeneratedValue.java new file mode 100644 index 000000000..2db2a374e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/GeneratedValue.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.GenerationType.AUTO; + +/** + * Provides for the specification of generation strategies for the + * values of primary keys. + * + *

    The GeneratedValue annotation + * may be applied to a primary key property or field of an entity or + * mapped superclass in conjunction with the {@link Id} annotation. + * The use of the GeneratedValue annotation is only + * required to be supported for simple primary keys. Use of the + * GeneratedValue annotation is not supported for derived + * primary keys. + * + *

    + *
    + *     Example 1:
    + *
    + *     @Id
    + *     @GeneratedValue(strategy=SEQUENCE, generator="CUST_SEQ")
    + *     @Column(name="CUST_ID")
    + *     public Long getId() { return id; }
    + *
    + *     Example 2:
    + *
    + *     @Id
    + *     @GeneratedValue(strategy=TABLE, generator="CUST_GEN")
    + *     @Column(name="CUST_ID")
    + *     Long id;
    + * 
    + * + * @see Id + * @see TableGenerator + * @see SequenceGenerator + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface GeneratedValue { + + /** + * (Optional) The primary key generation strategy + * that the persistence provider must use to + * generate the annotated entity primary key. + */ + GenerationType strategy() default AUTO; + + /** + * (Optional) The name of the primary key generator + * to use as specified in the {@link SequenceGenerator} + * or {@link TableGenerator} annotation. + *

    Defaults to the id generator supplied by persistence provider. + */ + String generator() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/GenerationType.java b/fine-jpa/src/com/fr/third/javax/persistence/GenerationType.java new file mode 100644 index 000000000..cf295aa49 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/GenerationType.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines the types of primary key generation strategies. + * + * @see GeneratedValue + * + * @since Java Persistence 1.0 + */ +public enum GenerationType { + + /** + * Indicates that the persistence provider must assign + * primary keys for the entity using an underlying + * database table to ensure uniqueness. + */ + TABLE, + + /** + * Indicates that the persistence provider must assign + * primary keys for the entity using a database sequence. + */ + SEQUENCE, + + /** + * Indicates that the persistence provider must assign + * primary keys for the entity using a database identity column. + */ + IDENTITY, + + /** + * Indicates that the persistence provider should pick an + * appropriate strategy for the particular database. The + * AUTO generation strategy may expect a database + * resource to exist, or it may attempt to create one. A vendor + * may provide documentation on how to create such resources + * in the event that it does not support schema generation + * or cannot create the schema resource at runtime. + */ + AUTO +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Id.java b/fine-jpa/src/com/fr/third/javax/persistence/Id.java new file mode 100644 index 000000000..9ee96868c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Id.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the primary key of an entity. + * The field or property to which the Id annotation is applied + * should be one of the following types: any Java primitive type; + * any primitive wrapper type; + * String; + * java.util.Date; + * java.sql.Date; + * java.math.BigDecimal; + * java.math.BigInteger. + * + *

    The mapped column for the primary key of the entity is assumed + * to be the primary key of the primary table. If no Column annotation + * is specified, the primary key column name is assumed to be the name + * of the primary key property or field. + * + *

    + *   Example:
    + *
    + *   @Id
    + *   public Long getId() { return id; }
    + * 
    + * + * @see Column + * @see GeneratedValue + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface Id { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/IdClass.java b/fine-jpa/src/com/fr/third/javax/persistence/IdClass.java new file mode 100644 index 000000000..f6d856c26 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/IdClass.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a composite primary key class that is mapped to + * multiple fields or properties of the entity. + * + *

    The names of the fields or properties in the primary key + * class and the primary key fields or properties of the entity + * must correspond and their types must be the same. + * + *

    + *
    + *   Example:
    + *
    + *   @IdClass(com.acme.EmployeePK.class)
    + *   @Entity
    + *   public class Employee {
    + *      @Id String empName;
    + *      @Id Date birthDay;
    + *      ...
    + *   }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface IdClass { + + /** Primary key class */ + Class value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Index.java b/fine-jpa/src/com/fr/third/javax/persistence/Index.java new file mode 100644 index 000000000..7fa94e566 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Index.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The Index annotation is used in schema generation. Note that it is not necessary to specify an index + * for a primary key, as the primary key index will be created automatically, however, the Index annotation + * may be used to specify the ordering of the columns in the index for the primary key. + * + * @since JPA 2.1 + */ +@Target({}) @Retention(RUNTIME) +public @interface Index { + /** + * (Optional) The name of the index. Defaults to a provider-generated value. + * + * @return The index name + */ + String name() default ""; + + /** + * (Required) The names of the columns to be included in the index. + * + * @return The names of the columns making up the index + */ + String columnList(); + + /** + * (Optional) Whether the index is unique. Default is false. + * + * @return Is the index unique? + */ + boolean unique() default false; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Inheritance.java b/fine-jpa/src/com/fr/third/javax/persistence/Inheritance.java new file mode 100644 index 000000000..186214781 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Inheritance.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.InheritanceType.SINGLE_TABLE; + +/** + * Defines the inheritance strategy to be used for an entity class + * hierarchy. It is specified on the entity class that is the root of + * the entity class hierarchy. If the Inheritance annotation is not + * specified or if no inheritance type is specified for an entity + * class hierarchy, the SINGLE_TABLE mapping strategy is used. + * + *
    + *
    + *   Example:
    + *
    + *   @Entity
    + *   @Inheritance(strategy=JOINED)
    + *   public class Customer { ... }
    + *
    + *   @Entity
    + *   public class ValuedCustomer extends Customer { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) + +public @interface Inheritance { + + /** The strategy to be used for the entity inheritance hierarchy. */ + InheritanceType strategy() default SINGLE_TABLE; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/InheritanceType.java b/fine-jpa/src/com/fr/third/javax/persistence/InheritanceType.java new file mode 100644 index 000000000..21c812daf --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/InheritanceType.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines inheritance strategy options. + * + * @since Java Persistence 1.0 + */ +public enum InheritanceType { + + /** A single table per class hierarchy. */ + SINGLE_TABLE, + + /** A table per concrete entity class. */ + TABLE_PER_CLASS, + + /** + * A strategy in which fields that are specific to a + * subclass are mapped to a separate table than the fields + * that are common to the parent class, and a join is + * performed to instantiate the subclass. + */ + JOINED +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/JoinColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/JoinColumn.java new file mode 100644 index 000000000..8c855b6bf --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/JoinColumn.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a column for joining an entity association or element + * collection. If the JoinColumn annotation itself is + * defaulted, a single join column is assumed and the default values + * apply. + * + *
    + *   Example:
    + *
    + *   @ManyToOne
    + *   @JoinColumn(name="ADDR_ID")
    + *   public Address getAddress() { return address; }
    + *
    + *
    + *   Example: unidirectional one-to-many association using a foreign key mapping
    + *
    + *   // In Customer class
    + *   @OneToMany
    + *   @JoinColumn(name="CUST_ID") // join column is in table for Order
    + *   public Set<Order> getOrders() {return orders;}
    + * 
    + * + * @see ManyToOne + * @see OneToMany + * @see OneToOne + * @see JoinTable + * @see CollectionTable + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface JoinColumn { + + /** + * (Optional) The name of the foreign key column. + * The table in which it is found depends upon the + * context. + *
      + *
    • If the join is for a OneToOne or ManyToOne + * mapping using a foreign key mapping strategy, + * the foreign key column is in the table of the + * source entity or embeddable. + *
    • If the join is for a unidirectional OneToMany mapping + * using a foreign key mapping strategy, the foreign key is in the + * table of the target entity. + *
    • If the join is for a ManyToMany mapping or for a OneToOne + * or bidirectional ManyToOne/OneToMany mapping using a join + * table, the foreign key is in a join table. + *
    • If the join is for an element collection, the foreign + * key is in a collection table. + *
    + * + *

    Default (only applies if a single join column is used): + * The concatenation of the following: the name of the + * referencing relationship property or field of the referencing + * entity or embeddable class; "_"; the name of the referenced + * primary key column. + * If there is no such referencing relationship property or + * field in the entity, or if the join is for an element collection, + * the join column name is formed as the + * concatenation of the following: the name of the entity; "_"; + * the name of the referenced primary key column. + */ + String name() default ""; + + /** + * (Optional) The name of the column referenced by this foreign + * key column. + *

      + *
    • When used with entity relationship mappings other + * than the cases described here, the referenced column is in the + * table of the target entity. + *
    • When used with a unidirectional OneToMany foreign key + * mapping, the referenced column is in the table of the source + * entity. + *
    • When used inside a JoinTable annotation, + * the referenced key column is in the entity table of the owning + * entity, or inverse entity if the join is part of the inverse + * join definition. + *
    • When used in a CollectionTable mapping, the + * referenced column is in the table of the entity containing the + * collection. + *
    + * + *

    Default (only applies if single join column is being + * used): The same name as the primary key column of the + * referenced table. + */ + String referencedColumnName() default ""; + + /** + * (Optional) Whether the property is a unique key. This is a + * shortcut for the UniqueConstraint annotation at + * the table level and is useful for when the unique key + * constraint is only a single field. It is not necessary to + * explicitly specify this for a join column that corresponds to a + * primary key that is part of a foreign key. + */ + boolean unique() default false; + + /** (Optional) Whether the foreign key column is nullable. */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in + * SQL INSERT statements generated by the persistence + * provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in + * SQL UPDATE statements generated by the persistence + * provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when + * generating the DDL for the column. + *

    Defaults to the generated SQL for the column. + */ + String columnDefinition() default ""; + + /** + * (Optional) The name of the table that contains + * the column. If a table is not specified, the column + * is assumed to be in the primary table of the + * applicable entity. + * + *

    Default: + *

      + *
    • If the join is for a OneToOne or ManyToOne mapping + * using a foreign key mapping strategy, the name of the table of + * the source entity or embeddable. + *
    • If the join is for a unidirectional OneToMany mapping + * using a foreign key mapping strategy, the name of the table of + * the target entity. + *
    • If the join is for a ManyToMany mapping or + * for a OneToOne or bidirectional ManyToOne/OneToMany mapping + * using a join table, the name of the join table. + *
    • If the join is for an element collection, the name of the collection table. + *
    + */ + String table() default ""; + + /** + * (Optional) The foreign key constraint specification for the join column. This is used only if table generation + * is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/JoinColumns.java b/fine-jpa/src/com/fr/third/javax/persistence/JoinColumns.java new file mode 100644 index 000000000..3eb6b5088 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/JoinColumns.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Defines mapping for composite foreign keys. This annotation + * groups JoinColumn annotations for the same relationship. + * + *

    When the JoinColumns annotation is used, + * both the name and the referencedColumnName elements + * must be specified in each such JoinColumn annotation. + * + *

    + *
    + *    Example:
    + *    @ManyToOne
    + *    @JoinColumns({
    + *        @JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
    + *        @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
    + *    })
    + *    public Address getAddress() { return address; }
    + * 
    + * + * @see JoinColumn + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface JoinColumns { + + /** + * The join columns that map the relationship. + */ + JoinColumn[] value(); + + /** + * (Optional) The foreign key constraint specification for the join columns. This is used only if table + * generation is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/JoinTable.java b/fine-jpa/src/com/fr/third/javax/persistence/JoinTable.java new file mode 100644 index 000000000..6a3a7df84 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/JoinTable.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used in the mapping of associations. It is specified on the + * owning side of an association. + * + *

    A join table is typically used in the mapping of many-to-many + * and unidirectional one-to-many associations. It may also be used to + * map bidirectional many-to-one/one-to-many associations, + * unidirectional many-to-one relationships, and one-to-one + * associations (both bidirectional and unidirectional). + * + *

    When a join table is used in mapping a relationship with an + *embeddable class on the owning side of the relationship, the + *containing entity rather than the embeddable class is considered the + *owner of the relationship. + * + *

    If the JoinTable annotation is missing, the + * default values of the annotation elements apply. + * The name of the join table is assumed to be the table names of the + * associated primary tables concatenated together (owning side + * first) using an underscore. + * + *

    + *
    + *    Example:
    + *
    + *    @JoinTable(
    + *        name="CUST_PHONE",
    + *        joinColumns=
    + *            @JoinColumn(name="CUST_ID", referencedColumnName="ID"),
    + *        inverseJoinColumns=
    + *            @JoinColumn(name="PHONE_ID", referencedColumnName="ID")
    + *    )
    + * 
    + * + * @see JoinColumn + * @see JoinColumns + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface JoinTable { + + /** + * (Optional) The name of the join table. + * + *

    Defaults to the concatenated names of + * the two associated primary entity tables, + * separated by an underscore. + */ + String name() default ""; + + /** (Optional) The catalog of the table. + *

    Defaults to the default catalog. + */ + String catalog() default ""; + + /** (Optional) The schema of the table. + *

    Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) The foreign key columns + * of the join table which reference the + * primary table of the entity owning the + * association. (I.e. the owning side of + * the association). + * + *

    Uses the same defaults as for {@link JoinColumn}. + */ + JoinColumn[] joinColumns() default {}; + + /** + * (Optional) The foreign key columns + * of the join table which reference the + * primary table of the entity that does + * not own the association. (I.e. the + * inverse side of the association). + * + *

    Uses the same defaults as for {@link JoinColumn}. + */ + JoinColumn[] inverseJoinColumns() default {}; + + /** + * (Optional) Unique constraints that are + * to be placed on the table. These are + * only used if table generation is in effect. + *

    Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default {}; + + /** + * (Optional) Indexes for the table. These are only used if table generation is in effect. + * + * @return The indexes + */ + Index[] indexes() default {}; + + /** + * (Optional) Used to specify or control the generation of a foreign key constraint for the columns + * corresponding to the joinColumns element when table generation is in effect. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); + + /** + * (Optional) Used to specify or control the generation of a foreign key constraint for the columns + * corresponding to the inverseJoinColumns element when table generation is in effect. + * + * @since Java Persistence 2.1 + */ + ForeignKey inverseForeignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Lob.java b/fine-jpa/src/com/fr/third/javax/persistence/Lob.java new file mode 100644 index 000000000..2b17cb73d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Lob.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that a persistent property or field should be persisted + * as a large object to a database-supported large object type. + * + *

    Portable applications should use the Lob annotation + * when mapping to a database Lob type. The Lob + * annotation may be used in conjunction with the {@link Basic} + * annotation or the {@link ElementCollection} annotation when the + * element collection value is of basic type. A Lob may + * be either a binary or character type. + * + *

    The Lob type is inferred from the type of the + * persistent field or property, and except for string and + * character-based types defaults to Blob. + *

    + *
    + *   Example 1:
    + *
    + *   @Lob @Basic(fetch=LAZY)
    + *   @Column(name="REPORT")
    + *   protected String report;
    + *
    + *   Example 2:
    + *
    + *   @Lob @Basic(fetch=LAZY)
    + *   @Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL")
    + *   protected byte[] pic;
    + *
    + * 
    + * + * @see Basic + * @see ElementCollection + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Lob { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/LockModeType.java b/fine-jpa/src/com/fr/third/javax/persistence/LockModeType.java new file mode 100644 index 000000000..efb37f170 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/LockModeType.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Lock modes can be specified by means of passing a LockModeType + * argument to one of the {@link com.fr.third.javax.persistence.EntityManager} methods that take locks + * (lock, find, or refresh) or + * to the {@link Query#setLockMode Query.setLockMode()} or + * {@link TypedQuery#setLockMode TypedQuery.setLockMode()} method. + * + *

    Lock modes can be used to specify either optimistic or pessimistic locks. + * + *

    Optimistic locks are specified using {@link + * LockModeType#OPTIMISTIC LockModeType.OPTIMISTIC} and {@link + * LockModeType#OPTIMISTIC_FORCE_INCREMENT + * LockModeType.OPTIMISTIC_FORCE_INCREMENT}. The lock mode type + * values {@link LockModeType#READ LockModeType.READ} and + * {@link LockModeType#WRITE LockModeType.WRITE} are + * synonyms of OPTIMISTIC and + * OPTIMISTIC_FORCE_INCREMENT respectively. The latter + * are to be preferred for new applications. + * + *

    The semantics of requesting locks of type + * LockModeType.OPTIMISTIC and + * LockModeType.OPTIMISTIC_FORCE_INCREMENT are the + * following. + * + *

    If transaction T1 calls for a lock of type + * LockModeType.OPTIMISTIC on a versioned object, + * the entity manager must ensure that neither of the following + * phenomena can occur: + *

      + *
    • P1 (Dirty read): Transaction T1 modifies a row. + * Another transaction T2 then reads that row and obtains + * the modified value, before T1 has committed or rolled back. + * Transaction T2 eventually commits successfully; it does not + * matter whether T1 commits or rolls back and whether it does + * so before or after T2 commits. + *
    • + *
    • P2 (Non-repeatable read): Transaction T1 reads a row. + * Another transaction T2 then modifies or deletes that row, + * before T1 has committed. Both transactions eventually commit + * successfully. + * + *
    + * + *

    Lock modes must always prevent the phenomena P1 and P2. + * + *

    In addition, calling a lock of type + * LockModeType.OPTIMISTIC_FORCE_INCREMENT on a versioned object, + * will also force an update (increment) to the entity's version + * column. + * + *

    The persistence implementation is not required to support + * the use of optimistic lock modes on non-versioned objects. When it + * cannot support a such lock call, it must throw the {@link + * PersistenceException}. + * + *

    The lock modes {@link LockModeType#PESSIMISTIC_READ + * LockModeType.PESSIMISTIC_READ}, {@link + * LockModeType#PESSIMISTIC_WRITE LockModeType.PESSIMISTIC_WRITE}, and + * {@link LockModeType#PESSIMISTIC_FORCE_INCREMENT + * LockModeType.PESSIMISTIC_FORCE_INCREMENT} are used to immediately + * obtain long-term database locks. + * + *

    The semantics of requesting locks of type + * LockModeType.PESSIMISTIC_READ, LockModeType.PESSIMISTIC_WRITE, and + * LockModeType.PESSIMISTIC_FORCE_INCREMENT are the following. + * + *

    If transaction T1 calls for a lock of type + * LockModeType.PESSIMISTIC_READ or + * LockModeType.PESSIMISTIC_WRITE on an object, the entity + * manager must ensure that neither of the following phenomena can + * occur: + *

      + *
    • P1 (Dirty read): Transaction T1 modifies a + * row. Another transaction T2 then reads that row and obtains the + * modified value, before T1 has committed or rolled back. + * + *
    • P2 (Non-repeatable read): Transaction T1 reads a row. Another + * transaction T2 then modifies or deletes that row, before T1 has + * committed or rolled back. + *
    + * + *

    A lock with LockModeType.PESSIMISTIC_WRITE can be obtained on + * an entity instance to force serialization among transactions + * attempting to update the entity data. A lock with + * LockModeType.PESSIMISTIC_READ can be used to query data using + * repeatable-read semantics without the need to reread the data at + * the end of the transaction to obtain a lock, and without blocking + * other transactions reading the data. A lock with + * LockModeType.PESSIMISTIC_WRITE can be used when querying data and + * there is a high likelihood of deadlock or update failure among + * concurrent updating transactions. + * + *

    The persistence implementation must support use of locks of type + * LockModeType.PESSIMISTIC_READ + * LockModeType.PESSIMISTIC_WRITE on a non-versioned entity as well as + * on a versioned entity. + * + *

    When the lock cannot be obtained, and the database locking + * failure results in transaction-level rollback, the provider must + * throw the {@link PessimisticLockException} and ensure that the JTA + * transaction or EntityTransaction has been marked for rollback. + * + *

    When the lock cannot be obtained, and the database locking + * failure results in only statement-level rollback, the provider must + * throw the {@link LockTimeoutException} (and must not mark the transaction + * for rollback). + * + * @since Java Persistence 1.0 + */ +public enum LockModeType { + /** + * Synonymous with OPTIMISTIC. + * OPTIMISTIC is to be preferred for new + * applications. + * + */ + READ, + + /** + * Synonymous with OPTIMISTIC_FORCE_INCREMENT. + * OPTIMISTIC_FORCE_IMCREMENT is to be preferred for new + * applications. + * + */ + WRITE, + + /** + * Optimistic lock. + * + * @since Java Persistence 2.0 + */ + OPTIMISTIC, + + /** + * Optimistic lock, with version update. + * + * @since Java Persistence 2.0 + */ + OPTIMISTIC_FORCE_INCREMENT, + + /** + * + * Pessimistic read lock. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_READ, + + /** + * Pessimistic write lock. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_WRITE, + + /** + * Pessimistic write lock, with version update. + * + * @since Java Persistence 2.0 + */ + PESSIMISTIC_FORCE_INCREMENT, + + /** + * No lock. + * + * @since Java Persistence 2.0 + */ + NONE +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/LockTimeoutException.java b/fine-jpa/src/com/fr/third/javax/persistence/LockTimeoutException.java new file mode 100644 index 000000000..7ad9090ad --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/LockTimeoutException.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when an pessimistic locking + * conflict occurs that does not result in transaction rollback. This + * exception may be thrown as part of an API call, at, flush or at + * commit time. The current transaction, if one is active, will be not + * be marked for rollback. + * + * @since Java Persistence 2.0 + */ +public class LockTimeoutException extends PersistenceException { + /** The object that caused the exception */ + Object entity; + + /** + * Constructs a new LockTimeoutException exception + * with null as its detail message. + */ + public LockTimeoutException() { + super(); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message. + * @param message the detail message. + */ + public LockTimeoutException(String message) { + super(message); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message and cause. + * @param message the detail message. + * @param cause the cause. + */ + public LockTimeoutException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified cause. + * @param cause the cause. + */ + public LockTimeoutException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified object. + * @param entity the entity. + */ + public LockTimeoutException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new LockTimeoutException exception + * with the specified detail message, cause, and entity. + * @param message the detail message. + * @param cause the cause. + * @param entity the entity. + */ + public LockTimeoutException(String message, Throwable cause, Object entity) { + super(message, cause); + this.entity = entity; + } + + /** + * Returns the object that caused this exception. + * @return the entity + */ + public Object getObject() { + return this.entity; + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ManyToMany.java b/fine-jpa/src/com/fr/third/javax/persistence/ManyToMany.java new file mode 100644 index 000000000..df9e02c0a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ManyToMany.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.LAZY; + +/** + * Defines a many-valued association with many-to-many multiplicity. + * + *

    Every many-to-many association has two sides, the owning side + * and the non-owning, or inverse, side. The join table is specified + * on the owning side. If the association is bidirectional, either + * side may be designated as the owning side. If the relationship is + * bidirectional, the non-owning side must use the mappedBy element of + * the ManyToMany annotation to specify the relationship field or + * property of the owning side. + * + *

    The join table for the relationship, if not defaulted, is + * specified on the owning side. + * + *

    The ManyToMany annotation may be used within an + * embeddable class contained within an entity class to specify a + * relationship to a collection of entities. If the relationship is + * bidirectional and the entity containing the embeddable class is the + * owner of the relationship, the non-owning side must use the + * mappedBy element of the ManyToMany + * annotation to specify the relationship field or property of the + * embeddable class. The dot (".") notation syntax must be used in the + * mappedBy element to indicate the relationship + * attribute within the embedded attribute. The value of each + * identifier used with the dot notation is the name of the respective + * embedded field or property. + * + *

    + *
    + *    Example 1:
    + *
    + *    // In Customer class:
    + *
    + *    @ManyToMany
    + *    @JoinTable(name="CUST_PHONES")
    + *    public Set<PhoneNumber> getPhones() { return phones; }
    + *
    + *    // In PhoneNumber class:
    + *
    + *    @ManyToMany(mappedBy="phones")
    + *    public Set<Customer> getCustomers() { return customers; }
    + *
    + *    Example 2:
    + *
    + *    // In Customer class:
    + *
    + *    @ManyToMany(targetEntity=com.acme.PhoneNumber.class)
    + *    public Set getPhones() { return phones; }
    + *
    + *    // In PhoneNumber class:
    + *
    + *    @ManyToMany(targetEntity=com.acme.Customer.class, mappedBy="phones")
    + *    public Set getCustomers() { return customers; }
    + *
    + *    Example 3:
    + *
    + *    // In Customer class:
    + *
    + *    @ManyToMany
    + *    @JoinTable(name="CUST_PHONE",
    + *        joinColumns=
    + *            @JoinColumn(name="CUST_ID", referencedColumnName="ID"),
    + *        inverseJoinColumns=
    + *            @JoinColumn(name="PHONE_ID", referencedColumnName="ID")
    + *        )
    + *    public Set<PhoneNumber> getPhones() { return phones; }
    + *
    + *    // In PhoneNumberClass:
    + *
    + *    @ManyToMany(mappedBy="phones")
    + *    public Set<Customer> getCustomers() { return customers; }
    + * 
    + * + * @see JoinTable + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ManyToMany { + + /** + * (Optional) The entity class that is the target of the + * association. Optional only if the collection-valued + * relationship property is defined using Java generics. Must be + * specified otherwise. + * + *

    Defaults to the parameterized type of + * the collection when defined using generics. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to the target + * of the association. + * + *

    When the target collection is a {@link java.util.Map + * java.util.Map}, the cascade element applies to the + * map value. + * + *

    Defaults to no operations being cascaded. + */ + CascadeType[] cascade() default {}; + + /** (Optional) Whether the association should be lazily loaded or + * must be eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the associated entities + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; + + /** + * The field that owns the relationship. Required unless + * the relationship is unidirectional. + */ + String mappedBy() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ManyToOne.java b/fine-jpa/src/com/fr/third/javax/persistence/ManyToOne.java new file mode 100644 index 000000000..e9f860741 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ManyToOne.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.EAGER; + +/** + * Defines a single-valued association to another entity class that + * has many-to-one multiplicity. It is not normally necessary to + * specify the target entity explicitly since it can usually be + * inferred from the type of the object being referenced. If the + * relationship is bidirectional, the non-owning + * OneToMany entity side must used the + * mappedBy element to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + *

    The ManyToOne annotation may be used within an + * embeddable class to specify a relationship from the embeddable + * class to an entity class. If the relationship is bidirectional, the + * non-owning OneToMany entity side must use the mappedBy + * element of the OneToMany annotation to specify the + * relationship field or property of the embeddable field or property + * on the owning side of the relationship. The dot (".") notation + * syntax must be used in the mappedBy element to indicate the + * relationship attribute within the embedded attribute. The value of + * each identifier used with the dot notation is the name of the + * respective embedded field or property. + *

    + *
    + *     Example 1:
    + *
    + *     @ManyToOne(optional=false)
    + *     @JoinColumn(name="CUST_ID", nullable=false, updatable=false)
    + *     public Customer getCustomer() { return customer; }
    + *
    + *
    + *     Example 2:
    + *
    + *     @Entity
    + *        public class Employee {
    + *        @Id int id;
    + *        @Embedded JobInfo jobInfo;
    + *        ...
    + *     }
    + *
    + *     @Embeddable
    + *        public class JobInfo {
    + *        String jobDescription;
    + *        @ManyToOne ProgramManager pm; // Bidirectional
    + *     }
    + *
    + *     @Entity
    + *        public class ProgramManager {
    + *        @Id int id;
    + *        @OneToMany(mappedBy="jobInfo.pm")
    + *        Collection<Employee> manages;
    + *     }
    + *
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) + +public @interface ManyToOne { + + /** + * (Optional) The entity class that is the target of + * the association. + * + *

    Defaults to the type of the field or property + * that stores the association. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + * + *

    By default no operations are cascaded. + */ + CascadeType[] cascade() default {}; + + /** + * (Optional) Whether the association should be lazily + * loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime that + * the associated entity must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Whether the association is optional. If set + * to false then a non-null relationship must always exist. + */ + boolean optional() default true; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKey.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKey.java new file mode 100644 index 000000000..7ac35591e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKey.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the map key for associations of type + * {@link java.util.Map java.util.Map} when the map key is itself the primary + * key or a persistent field or property of the entity that is + * the value of the map. + * + *

    If a persistent field or property other than the primary + * key is used as a map key then it is expected to have a + * uniqueness constraint associated with it. + * + *

    The {@link MapKeyClass} annotation is not used when + * MapKey is specified and vice versa. + * + *

    + *
    + *    Example 1:
    + *
    + *    @Entity
    + *    public class Department {
    + *        ...
    + *        @OneToMany(mappedBy="department")
    + *        @MapKey  // map key is primary key
    + *        public Map<Integer, Employee> getEmployees() {... }
    + *        ...
    + *    }
    + *
    + *    @Entity
    + *    public class Employee {
    + *        ...
    + *        @Id Integer getEmpId() { ... }
    + *        @ManyToOne
    + *        @JoinColumn(name="dept_id")
    + *        public Department getDepartment() { ... }
    + *        ...
    + *    }
    + *
    + *    Example 2:
    + *
    + *    @Entity
    + *        public class Department {
    + *        ...
    + *        @OneToMany(mappedBy="department")
    + *        @MapKey(name="name")
    + *        public Map<String, Employee> getEmployees() {... }
    + *        ...
    + *    }
    + *
    + *    @Entity
    + *        public class Employee {
    + *        @Id public Integer getEmpId() { ... }
    + *        ...
    + *        @ManyToOne
    + *        @JoinColumn(name="dept_id")
    + *        public Department getDepartment() { ... }
    + *        ...
    + *    }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface MapKey { + + /** + * (Optional) The name of the persistent field or property of the + * associated entity that is used as the map key. + *

    Default: If the + * name element is not specified, the primary key of the + * associated entity is used as the map key. If the + * primary key is a composite primary key and is mapped + * as IdClass, an instance of the primary key + * class is used as the key. + */ + String name() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyClass.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyClass.java new file mode 100644 index 000000000..9f26a27b4 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyClass.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the type of the map key for associations of type + * java.util.Map. The map key can be a basic type, an + * embeddable class, or an entity. If the map is specified using Java + * generics, the MapKeyClass annotation and associated + * type need not be specified; otherwise they must be specified. + * + *

    The MapKeyClass annotation is used in conjunction + * with ElementCollection or one of the collection-valued + * relationship annotations (OneToMany or ManyToMany). + * The MapKey annotation is not used when + * MapKeyClass is specified and vice versa. + * + *

    + *
    + *    Example 1:
    + *
    + *    @Entity
    + *    public class Item {
    + *       @Id int id;
    + *       ...
    + *       @ElementCollection(targetClass=String.class)
    + *       @MapKeyClass(String.class)
    + *       Map images;  // map from image name to image filename
    + *       ...
    + *    }
    + *
    + *    Example 2:
    + *
    + *    // MapKeyClass and target type of relationship can be defaulted
    + *
    + *    @Entity
    + *    public class Item {
    + *       @Id int id;
    + *       ...
    + *       @ElementCollection
    + *       Map<String, String> images;
    + *        ...
    + *     }
    + *
    + *     Example 3:
    + *
    + *     @Entity
    + *     public class Company {
    + *        @Id int id;
    + *        ...
    + *        @OneToMany(targetEntity=com.example.VicePresident.class)
    + *        @MapKeyClass(com.example.Division.class)
    + *        Map organization;
    + *     }
    + *
    + *     Example 4:
    + *
    + *     // MapKeyClass and target type of relationship are defaulted
    + *
    + *     @Entity
    + *     public class Company {
    + *        @Id int id;
    + *        ...
    + *        @OneToMany
    + *        Map<Division, VicePresident> organization;
    + *     }
    + *
    + * 
    + * @see ElementCollection + * @see OneToMany + * @see ManyToMany + * @since Java Persistence 2.0 + */ + +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyClass { + /**(Required) The type of the map key.*/ + Class value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyColumn.java new file mode 100644 index 000000000..c003e677e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyColumn.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the mapping for the key column of a map whose + * map key is a basic type. If the name element is not specified, it + * defaults to the concatenation of the following: the name of the + * referencing relationship field or property; "_"; "KEY". + * + *
    + *    Example:
    + *
    + *    @Entity
    + *    public class Item {
    + *       @Id int id;
    + *       ...
    + *       @ElementCollection
    + *       @MapKeyColumn(name="IMAGE_NAME")
    + *       @Column(name="IMAGE_FILENAME")
    + *       @CollectionTable(name="IMAGE_MAPPING")
    + *       Map<String, String> images;  // map from image name to filename
    + *       ...
    + *    }
    + * 
    + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyColumn { + + /** + * (Optional) The name of the map key column. The table in which it is found + * depends upon the context. If the map key is for an element collection, + * the map key column is in the collection table for the map value. If the + * map key is for a ManyToMany entity relationship or for a OneToMany entity + * relationship using a join table, the map key column is in a join table. + * If the map key is for a OneToMany entity relationship using a foreign key + * mapping strategy, the map key column is in the table of the entity that + * is the value of the map. + *

    Defaults to the concatenation of the following: the name of + * the referencing relationship field or property; "_"; "KEY". + */ + String name() default ""; + + /** + * (Optional) Whether the column is a unique key. This is a + * shortcut for the UniqueConstraint annotation + * at the table level and is useful for when the unique key + * constraint corresponds to only a single column. This + * constraint applies in addition to any constraint entailed + * by primary key mapping and to constraints specified at the + * table level. + */ + boolean unique() default false; + + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default false; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. + *

    Defaults to the generated SQL to create a + * column of the inferred type. + * + */ + String columnDefinition() default ""; + + /** (Optional) The name of the table that contains the column. + * + *

    Defaults: If the map key is for an element collection, + * the name of the collection table for the map value. If the + * map key is for a OneToMany or ManyToMany entity + * relationship using a join table, the name of the join table + * for the map. If the map key is for a OneToMany entity + * relationship using a foreign key mapping strategy, the name + * of the primary table of the entity that is the value of the + * map. + */ + String table() default ""; + + /** + * (Optional) The column length. (Applies only if a string-valued column is + * used.) + */ + int length() default 255; + + /** + * (Optional) The precision for a decimal (exact numeric) column. (Applies + * only if a decimal column is used.) + * + *

    Default: 0. (The value must be set by the developer.) + */ + int precision() default 0; // decimal precision + + /** + * (Optional) The scale for a decimal (exact numeric) column. (Applies only + * if a decimal column is used.) + */ + int scale() default 0; // decimal scale +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyEnumerated.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyEnumerated.java new file mode 100644 index 000000000..9d26d068b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyEnumerated.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ + +// $Id: $ + +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.EnumType.ORDINAL; + +/** + * Specifies the enum type for a map key whose basic type is an enumerated type. + * + * The MapKeyEnumerated annotation can be applied to an + * element collection or relationship of type java.util.Map, in + * conjunction with the ElementCollection, OneToMany, or + * ManyToMany annotation. + * If the enumerated type is not specified or the MapKeyEnumerated + * annotation is not used, the enumerated type is assumed to be + * ORDINAL. + * + *

    + *   Example:
    + *
    + *   public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED, IN_PROGRESS}
    + *
    + *   public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
    + *
    + *   @Entity public class Employee {
    + *       @ManyToMany
    + *       public Projects<ProjectStatus, Project> getProjects() {...}
    + *
    + *       @OneToMany
    + *       @MapKeyEnumerated(STRING)
    + *       public Map<SalaryRate, Employee> getEmployees() {...}
    + *       ...
    + *   }
    + * 
    + * + * @see ElementCollection + * @see OneToMany + * @see ManyToMany + * + * @since Java Persistence 2.0 + */ +@Target({METHOD, FIELD}) @Retention(RUNTIME) +public @interface MapKeyEnumerated { + + /** (Optional) The type used in mapping a map key enum type. */ + EnumType value() default ORDINAL; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumn.java new file mode 100644 index 000000000..76edb1434 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumn.java @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a mapping to an entity that is a map key. The map key + * join column is in the collection table, join table, or table of the + * target entity that is used to represent the map. If no + * MapKeyJoinColumn annotation is specified, a single + * join column is assumed and the default values apply. + * + *
    + *
    + *    Example 1:
    + *
    + *    @Entity
    + *    public class Company {
    + *       @Id int id;
    + *       ...
    + *       @OneToMany   // unidirectional
    + *       @JoinTable(name="COMPANY_ORGANIZATION",
    + *                  joinColumns=@JoinColumn(name="COMPANY"),
    + *                  inverseJoinColumns=@JoinColumn(name="VICEPRESIDENT"))
    + *       @MapKeyJoinColumn(name="DIVISION")
    + *       Map<Division, VicePresident> organization;
    + *    }
    + *
    + *    Example 2:
    + *
    + *    @Entity
    + *    public class VideoStore {
    + *       @Id int id;
    + *       String name;
    + *       Address location;
    + *       ...
    + *       @ElementCollection
    + *       @CollectionTable(name="INVENTORY",
    + *                        joinColumns=@JoinColumn(name="STORE"))
    + *       @Column(name="COPIES_IN_STOCK")
    + *       @MapKeyJoinColumn(name="MOVIE", referencedColumnName="ID")
    + *       Map<Movie, Integer> videoInventory;
    + *       ...
    + *     }
    + *
    + *     @Entity
    + *     public class Movie {
    + *        @Id long id;
    + *        String title;
    + *        ...
    + *     }
    + *
    + *     Example 3:
    + *
    + *     @Entity
    + *     public class Student {
    + *        @Id int studentId;
    + *        ...
    + *        @ManyToMany  // students and courses are also many-many
    + *        @JoinTable(name="ENROLLMENTS",
    + *                   joinColumns=@JoinColumn(name="STUDENT"),
    + *                   inverseJoinColumns=@JoinColumn(name="SEMESTER"))
    + *        @MapKeyJoinColumn(name="COURSE")
    + *        Map<Course, Semester>  enrollment;
    + *        ...
    + *     }
    + * 
    + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyJoinColumn { + /** + * (Optional) The name of the foreign key column for the map + * key. The table in which it is found depends upon the + * context. + *
      + *
    • If the join is for a map key for an + * element collection, the foreign key column is in the + * collection table for the map value. + *
    • If the join is for a map key for a ManyToMany entity + * relationship or for a OneToMany entity relationship + * using a join table, the foreign key column is in a join table. + *
    • If the join is for a OneToMany entity relationship using + * a foreign key mapping strategy, the foreign key column for the + * map key is in the table of the entity that is the value of the map. + *
    + * + *

    Default (only applies if a single join column is used.) + * The concatenation of the following: the name of the + * referencing relationship property or field of the + * referencing entity or embeddable class; "_"; "KEY". + */ + String name() default ""; + + /** + * (Optional) The name of the column referenced by this foreign key column. + * The referenced column is in the table of the target entity. + * + *

    Default (only applies if single join column is being + * used.) The same name as the primary key column of the + * referenced table + */ + String referencedColumnName() default ""; + + /** + * (Optional) Whether the property is a unique key. This is a + * shortcut for the UniqueConstraint annotation + * at the table level and is useful for when the unique key + * constraint is only a single field. + */ + boolean unique() default false; + + /** + * (Optional) Whether the foreign key column is nullable. + */ + boolean nullable() default false; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. + * Defaults to SQL generated by the provider for the column. + */ + String columnDefinition() default ""; + + /** + * (Optional) The name of the table that contains the foreign key column. + *

      + *
    • If the join is for a map key for an element collection, the foreign key + * column is in the collection table for the map value. + *
    • If the join is for a map key for a ManyToMany entity relationship + * or for a OneToMany entity relationship using a join table, + * the foreign key column is in a join table. + *
    • If the join is for a OneToMany entity relationship using a foreign + * key mapping strategy, the foreign key column for the map key is in the + * table of the entity that is the value of the map. + *
    + *

    Default: + *

      + *
    • If the map is for an element collection, the + * name of the collection table for the map value. + *
    • If the map is for a OneToMany or ManyToMany entity relationship + * using a join table, the name of the join table for the map. + *
    • If the map is for a OneToMany entity relationship using a + * foreign key mapping strategy, the name of the primary table + * of the entity that is the value of the map. + *
    + */ + String table() default ""; + + /** + * (Optional) The foreign key constraint specification for the join column. This is used only if table generation + * is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumns.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumns.java new file mode 100644 index 000000000..5deef29c4 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyJoinColumns.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Supports composite map keys that reference entities. + *

    The MapKeyJoinColumns annotation groups + * MapKeyJoinColumn annotations. When the + * MapKeyJoinColumns annotation is used, both the + * name and the referencedColumnName + * elements must be specified in each of the grouped + * MapKeyJoinColumn annotations. + * + * @see MapKeyJoinColumn + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapKeyJoinColumns { + /** + * (Required) The map key join columns that are used to map to the entity + * that is the map key. + */ + MapKeyJoinColumn[] value(); + + /** + * (Optional) The foreign key constraint specification for the join columns. This is used only if table generation + * is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapKeyTemporal.java b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyTemporal.java new file mode 100644 index 000000000..ec647975d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapKeyTemporal.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * This annotation must be specified for persistent map keys of type + * {@link java.util.Date} and {@link java.util.Calendar}. It may only be + * specified for map keys of these types. + * + *

    The MapKeyTemporal annotation can be applied to an + * element collection or relationship of type java.util.Map + * in conjunction with the ElementCollection, + * OneToMany, or ManyToMany annotation. + * + *

    + *     Example:
    + *
    + *     @OneToMany
    + *     @MapKeyTemporal(DATE)
    + *     protected java.util.Map<java.util.Date, Employee> employees;
    + * 
    + * + * @since Java Persistence 2.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface MapKeyTemporal { + + /** (Required) The type used in mapping + * java.util.Date or + * java.util.Calendar. + */ + TemporalType value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MappedSuperclass.java b/fine-jpa/src/com/fr/third/javax/persistence/MappedSuperclass.java new file mode 100644 index 000000000..ba1528ba1 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MappedSuperclass.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Designates a class whose mapping information is applied + * to the entities that inherit from it. A mapped superclass + * has no separate table defined for it. + * + *

    A class designated with the MappedSuperclass + * annotation can be mapped in the same way as an entity except that the + * mappings will apply only to its subclasses since no table + * exists for the mapped superclass itself. When applied to the + * subclasses the inherited mappings will apply in the context + * of the subclass tables. Mapping information may be overridden + * in such subclasses by using the AttributeOverride and + * AssociationOverride annotations or corresponding XML elements. + * + *

    + *    Example: Concrete class as a mapped superclass
    + *
    + *    @MappedSuperclass
    + *    public class Employee {
    + *
    + *        @Id protected Integer empId;
    + *        @Version protected Integer version;
    + *        @ManyToOne @JoinColumn(name="ADDR")
    + *        protected Address address;
    + *
    + *        public Integer getEmpId() { ... }
    + *        public void setEmpId(Integer id) { ... }
    + *        public Address getAddress() { ... }
    + *        public void setAddress(Address addr) { ... }
    + *    }
    + *
    + *    // Default table is FTEMPLOYEE table
    + *    @Entity
    + *    public class FTEmployee extends Employee {
    + *
    + *        // Inherited empId field mapped to FTEMPLOYEE.EMPID
    + *        // Inherited version field mapped to FTEMPLOYEE.VERSION
    + *        // Inherited address field mapped to FTEMPLOYEE.ADDR fk
    + *
    + *        // Defaults to FTEMPLOYEE.SALARY
    + *        protected Integer salary;
    + *
    + *        public FTEmployee() {}
    + *
    + *        public Integer getSalary() { ... }
    + *
    + *        public void setSalary(Integer salary) { ... }
    + *    }
    + *
    + *    @Entity @Table(name="PT_EMP")
    + *    @AssociationOverride(
    + *        name="address",
    + *        joincolumns=@JoinColumn(name="ADDR_ID"))
    + *    public class PartTimeEmployee extends Employee {
    + *
    + *        // Inherited empId field mapped to PT_EMP.EMPID
    + *        // Inherited version field mapped to PT_EMP.VERSION
    + *        // address field mapping overridden to PT_EMP.ADDR_ID fk
    + *        @Column(name="WAGE")
    + *        protected Float hourlyWage;
    + *
    + *        public PartTimeEmployee() {}
    + *
    + *        public Float getHourlyWage() { ... }
    + *        public void setHourlyWage(Float wage) { ... }
    + *    }
    + * 
    + * + * @see AttributeOverride + * @see AssociationOverride + * @since Java Persistence 1.0 + */ +@Documented +@Target({TYPE}) +@Retention(RUNTIME) +public @interface MappedSuperclass { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/MapsId.java b/fine-jpa/src/com/fr/third/javax/persistence/MapsId.java new file mode 100644 index 000000000..8a80df4c4 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/MapsId.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Designates a ManyToOne or + * OneToOne relationship attribute that provides the + * mapping for an {@link EmbeddedId} primary key, an attribute within + * an EmbeddedId primary key, or a simple primary key of + * the parent entity. The value element specifies the + * attribute within a composite key to which the relationship + * attribute corresponds. If the entity's primary key is of the same + * Java type as the primary key of the entity referenced by the + * relationship, the value attribute is not specified. + * + *
    + *    Example:
    + *
    + *    // parent entity has simple primary key
    + *
    + *    @Entity
    + *    public class Employee {
    + *       @Id long empId;
    + *       String name;
    + *       ...
    + *    }
    + *
    + *    // dependent entity uses EmbeddedId for composite key
    + *
    + *    @Embeddable
    + *    public class DependentId {
    + *       String name;
    + *       long empid;   // corresponds to primary key type of Employee
    + *    }
    + *
    + *    @Entity
    + *    public class Dependent {
    + *       @EmbeddedId DependentId id;
    + *        ...
    + *       @MapsId("empid")  //  maps the empid attribute of embedded id
    + *       @ManyToOne Employee emp;
    + *    }
    + * 
    + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface MapsId { + + /** + * (Optional) The name of the attribute within the composite key + * to which the relationship attribute corresponds. If not + * supplied, the relationship maps the entity’s primary + * key. + */ + String value() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedAttributeNode.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedAttributeNode.java new file mode 100644 index 000000000..d8fea702a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedAttributeNode.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The NamedAttributeNode annotation is used to specify an attribute node of within an entity graph or subgraph. + * + * @since JPA 2.1 + */ +@Target({}) +@Retention(RUNTIME) +public @interface NamedAttributeNode { + /** + * Specifies the name of the corresponding attribute. + */ + String value(); + + /** + * Refers to a NamedSubgraph specification that further characterizes an attribute node corresponding to a + * managed type (entity or embeddable). The value of the subgraph element must correspond to the name used for + * the subgraph in the NamedSubgraph element. If the referenced attribute is an entity which has entity + * subclasses, there may be more than one NamedSubgraph element with this name, and the subgraph element is + * considered to refer to all of these. + */ + String subgraph() default ""; + + /** + * Refers to a NamedSubgraph specification that further characterizes an attribute node corresponding to the + * key of a Map-valued attribute. The value of the the keySubgraph element must correspond to the name used for + * the subgraph in the NamedSubgraph element. If the referenced attribute is an entity which has entity + * subclasses, there may be more than one NamedSubgraph element with this name, and the keySubgraph element is + * considered to refer to all of these. + */ + String keySubgraph() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraph.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraph.java new file mode 100644 index 000000000..563214fdc --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraph.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The NamedEntityGraph annotation is used to define a named entity graph. The entity graph may be retrieved by name + * using the EntityManagerFactory interface. The entity graph may be used to specify the path and boundaries for find + * operations or queries. The NamedEntityGraph annotation must be applied to the entity class that forms the root of + * the corresponding graph of entities. + * + * @since JPA 2.1 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedEntityGraph { + /** + * The name element is used to refer to the entity graph. It defaults to the entity name of the root entity to + * which the annotation is applied. Entity graph names must be unique within the persistence unit. + */ + String name() default ""; + + /** + * The attributeNodes element lists attributes of the annotated entity class that are to be included in the + * entity graph. + */ + NamedAttributeNode[] attributeNodes() default {}; + + /** + * The includeAllAttributes element specifies that all attributes of the annotated entity class are to be + * included in the entity graph. An attributeNode element may still be used in conjunction with this element to + * specify a subgraph for the attribute. + */ + boolean includeAllAttributes() default false; + + /** + * The subgraphs element specifies a list of subgraphs, further specifying attributes that are managed types. + * These subgraphs are referenced by name from NamedAttributeNode definitions. + */ + NamedSubgraph[] subgraphs() default {}; + + /** + * The subclassSubgraphs element specifies a list of subgraphs that add additional attributes for subclasses of + * the root entity to which the annotation is applied. + */ + NamedSubgraph[] subclassSubgraphs() default {}; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraphs.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraphs.java new file mode 100644 index 000000000..27872162f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedEntityGraphs.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The NamedEntityGraphs annotation is used to specify multiple named entity graphs for the entity to which it is + * applied. + * + * @since JPA 2.1 + */ +@Target({TYPE}) @Retention(RUNTIME) +public @interface NamedEntityGraphs{ + NamedEntityGraph[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQueries.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQueries.java new file mode 100644 index 000000000..b34f1079a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQueries.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to specify multiple native SQL named queries. Query names + * are scoped to the persistence unit. The NamedNativeQueries + * annotation can be applied to an entity or mapped superclass. + * + * @see NamedNativeQuery + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedNativeQueries { + + /** (Required) Array of NamedNativeQuery annotations. */ + NamedNativeQuery[] value (); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQuery.java new file mode 100644 index 000000000..a0a36e802 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedNativeQuery.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a named native SQL query. + * Query names are scoped to the persistence unit. + * The NamedNativeQuery annotation can be applied to an + * entity or mapped superclass. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedNativeQuery { + + /** + * The name used to refer to the query with the {@link EntityManager} + * methods that create query objects. + */ + String name(); + + /** The SQL query string. */ + String query(); + + /** Query properties and hints. (May include vendor-specific query hints.) */ + QueryHint[] hints() default {}; + + /** The class of the result. */ + Class resultClass() default void.class; + + /** The name of a {@link SqlResultSetMapping}, as defined in metadata. */ + String resultSetMapping() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedQueries.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedQueries.java new file mode 100644 index 000000000..2218cb351 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedQueries.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies multiple named Java Persistence query language queries. + * Query names are scoped to the persistence unit. + * The NamedQueries annotation can be applied to an entity or mapped superclass. + * + * @see NamedQuery + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedQueries { + + /** (Required) An array of NamedQuery annotations. */ + NamedQuery [] value (); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedQuery.java new file mode 100644 index 000000000..d0ac4977f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedQuery.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.LockModeType.NONE; + +/** + * Specifies a static, named query in the Java Persistence query language. + * Query names are scoped to the persistence unit. + * The NamedQuery annotation can be applied to an entity or mapped superclass. + * + *

    The following is an example of the definition of a named query + * in the Java Persistence query language: + * + *

    + *    @NamedQuery(
    + *            name="findAllCustomersWithName",
    + *            query="SELECT c FROM Customer c WHERE c.name LIKE :custName"
    + *    )
    + * 
    + * + *

    The following is an example of the use of a named query: + * + *

    + *    @PersistenceContext
    + *    public EntityManager em;
    + *    ...
    + *    customers = em.createNamedQuery("findAllCustomersWithName")
    + *            .setParameter("custName", "Smith")
    + *            .getResultList();
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface NamedQuery { + + /** + * (Required) The name used to refer to the query with the {@link EntityManager} + * methods that create query objects. + */ + String name(); + + /** (Required) + * The query string in the Java Persistence query language. + */ + String query(); + + /** + * (Optional) The lock mode type to use in query execution. If a lockMode + * other than LockModeType.NONE is specified, the query must be executed in + * a transaction. + * @since Java Persistence 2.0 + */ + LockModeType lockMode() default NONE; + + /** (Optional) Query properties and hints. May include + * vendor-specific query hints. + */ + QueryHint[] hints() default {}; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQueries.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQueries.java new file mode 100644 index 000000000..43e88f70c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQueries.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies multiple named stored procedure queries. Query names are scoped to the persistence unit. + * The {@code NamedStoredProcedureQueries} annotation can be applied to an entity or mapped superclass. + * + * @since Java Persistence 2.1 + * + * @see NamedStoredProcedureQuery + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface NamedStoredProcedureQueries { + /** + * Array of NamedStoredProcedureQuery annotations. + */ + NamedStoredProcedureQuery[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQuery.java new file mode 100644 index 000000000..dda25dd78 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedStoredProcedureQuery.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies and names a stored procedure, its parameters, and its result type. + * + * The NamedStoredProcedureQuery annotation can be applied to an entity or mapped superclass. + * + * The name element is the name that is passed as an argument to the + * {@link EntityManager#createNamedStoredProcedureQuery(String)} method to create an executable + * StoredProcedureQuery object. Names are scoped to the persistence unit. + * + * The procedureName element is the name of the stored procedure in the database. + * + * The parameters of the stored procedure are specified by the parameters element. All + * parameters must be specified in the order in which they occur in the parameter list of the + * stored procedure. + * + * The resultClasses element refers to the class (or classes) that are used to map the results. The + * resultSetMappings element names one or more result set mappings, as defined by the + * {@link SqlResultSetMapping} annotation. + * + * If there are multiple result sets, it is assumed that they will be mapped using the same + * mechanism — e.g., either all via a set of result class mappings or all via a set of result + * set mappings. The order of the specification of these mappings must be the same as the order in + * which the result sets will be returned by the stored procedure invocation. If the stored procedure + * returns one or more result sets and no resultClasses or resultSetMappings element is specified, + * any result set will be returned as a list of type Object[]. The combining of different strategies + * for the mapping of stored procedure result sets is undefined. + * + * The hints element may be used to specify query properties and hints. Properties defined by this + * specification must be observed by the provider. Vendor-specific hints that are not recognized + * by a provider must be ignored. + * + * All parameters of a named stored procedure query must be specified using the StoredProcedureParameter + * annotation. + * + * @since Java Persistence 2.1 + * + * @see StoredProcedureQuery + * @see StoredProcedureParameter + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface NamedStoredProcedureQuery { + /** + * The name used to refer to the query with the {@link EntityManager} methods that create stored + * procedure query objects. + */ + String name(); + + /** + * The name of the stored procedure in the database. + */ + String procedureName(); + + /** + * Information about all parameters of the stored procedure. + */ + StoredProcedureParameter[] parameters() default {}; + + /** + * The class or classes that are used to map the results. + */ + Class[] resultClasses() default {}; + + /** + * The names of one or more result set mappings, as defined in metadata. + */ + String[] resultSetMappings() default {}; + + /** + * Query properties and hints. + */ + QueryHint[] hints() default {}; +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NamedSubgraph.java b/fine-jpa/src/com/fr/third/javax/persistence/NamedSubgraph.java new file mode 100644 index 000000000..f043f6d42 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NamedSubgraph.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * The NamedSubgraph annotation is used to further define an attribute node. It is referenced by its name from + * the subgraph or keySubgraph element of a NamedAttributeNode element. + * + * @since JPA 2.1 + */ +@Target({}) @Retention(RUNTIME) +public @interface NamedSubgraph { + /** + * The name element is the name used to reference the subgraph from a NamedAttributeNode definition. In the case + * of entity inheritance, multiple subgraph elements have the same name. + */ + String name(); + + /** + * The type element must be specified when the subgraph corresponds to a subclass of the entity type corresponding + * to the referencing attribute node. + */ + Class type() default void.class; + + /** + * Lists attributes of the class that must be included. If the subgraph corresponds to a subclass of the class + * referenced by the corresponding attribute node, only subclass-specific attributes are listed. + */ + NamedAttributeNode[] attributeNodes(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NoResultException.java b/fine-jpa/src/com/fr/third/javax/persistence/NoResultException.java new file mode 100644 index 000000000..818556b41 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NoResultException.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when {@link + * Query#getSingleResult Query.getSingleResult()} or {@link + * TypedQuery#getSingleResult TypedQuery.getSingleResult()}is executed on a query + * and there is no result to return. This exception will not cause + * the current transaction, if one is active, to be marked for + * rollback. + * + * @see Query#getSingleResult() + * @see TypedQuery#getSingleResult() + * + * @since Java Persistence 1.0 + */ +public class NoResultException extends PersistenceException { + + /** + * Constructs a new NoResultException exception with + * null as its detail message. + */ + public NoResultException() { + super(); + } + + /** + * Constructs a new NoResultException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public NoResultException(String message) { + super(message); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/NonUniqueResultException.java b/fine-jpa/src/com/fr/third/javax/persistence/NonUniqueResultException.java new file mode 100644 index 000000000..2dee13546 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/NonUniqueResultException.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when {@link + * Query#getSingleResult Query.getSingleResult()} or {@link + * TypedQuery#getSingleResult TypedQuery.getSingleResult()} is executed on a + * query and there is more than one result from the query. This + * exception will not cause the current transaction, if one is active, + * to be marked for rollback. + * + * @see Query#getSingleResult() + * @see TypedQuery#getSingleResult() + * + * @since Java Persistence 1.0 + */ +public class NonUniqueResultException extends PersistenceException { + + /** + * Constructs a new NonUniqueResultException exception + * with null as its detail message. + */ + public NonUniqueResultException() { + super(); + } + + /** + * Constructs a new NonUniqueResultException exception + * with the specified detail message. + * @param message the detail message. + */ + public NonUniqueResultException(String message) { + super(message); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/OneToMany.java b/fine-jpa/src/com/fr/third/javax/persistence/OneToMany.java new file mode 100644 index 000000000..d1258b8c0 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/OneToMany.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.LAZY; + +/** + * Defines a many-valued association with one-to-many multiplicity. + * + *

    If the collection is defined using generics to specify the + * element type, the associated target entity type need not be + * specified; otherwise the target entity class must be specified. + * If the relationship is bidirectional, the + * mappedBy element must be used to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + *

    The OneToMany annotation may be used within an embeddable class + * contained within an entity class to specify a relationship to a + * collection of entities. If the relationship is bidirectional, the + * mappedBy element must be used to specify the relationship field or + * property of the entity that is the owner of the relationship. + * + * When the collection is a java.util.Map, the cascade + * element and the orphanRemoval element apply to the map value. + * + *

    + *
    + *    Example 1: One-to-Many association using generics
    + *
    + *    // In Customer class:
    + *
    + *    @OneToMany(cascade=ALL, mappedBy="customer")
    + *    public Set<Order> getOrders() { return orders; }
    + *
    + *    In Order class:
    + *
    + *    @ManyToOne
    + *    @JoinColumn(name="CUST_ID", nullable=false)
    + *    public Customer getCustomer() { return customer; }
    + *
    + *
    + *    Example 2: One-to-Many association without using generics
    + *
    + *    // In Customer class:
    + *
    + *    @OneToMany(targetEntity=com.acme.Order.class, cascade=ALL,
    + *                mappedBy="customer")
    + *    public Set getOrders() { return orders; }
    + *
    + *    // In Order class:
    + *
    + *    @ManyToOne
    + *    @JoinColumn(name="CUST_ID", nullable=false)
    + *    public Customer getCustomer() { return customer; }
    + *
    + *
    + *    Example 3: Unidirectional One-to-Many association using a foreign key mapping
    + *
    + *    // In Customer class:
    + *
    + *    @OneToMany(orphanRemoval=true)
    + *    @JoinColumn(name="CUST_ID") // join column is in table for Order
    + *    public Set<Order> getOrders() {return orders;}
    + *
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface OneToMany { + + /** + * (Optional) The entity class that is the target + * of the association. Optional only if the collection + * property is defined using Java generics. + * Must be specified otherwise. + * + *

    Defaults to the parameterized type of + * the collection when defined using generics. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + *

    Defaults to no operations being cascaded. + * + *

    When the target collection is a {@link java.util.Map + * java.util.Map}, the cascade element applies to the + * map value. + */ + CascadeType[] cascade() default {}; + + /** (Optional) Whether the association should be lazily loaded or + * must be eagerly fetched. The EAGER strategy is a requirement on + * the persistence provider runtime that the associated entities + * must be eagerly fetched. The LAZY strategy is a hint to the + * persistence provider runtime. + */ + FetchType fetch() default LAZY; + + /** + * The field that owns the relationship. Required unless + * the relationship is unidirectional. + */ + String mappedBy() default ""; + + /** + * (Optional) Whether to apply the remove operation to entities that have + * been removed from the relationship and to cascade the remove operation to + * those entities. + * @since Java Persistence 2.0 + */ + boolean orphanRemoval() default false; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/OneToOne.java b/fine-jpa/src/com/fr/third/javax/persistence/OneToOne.java new file mode 100644 index 000000000..f31497d41 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/OneToOne.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static com.fr.third.javax.persistence.FetchType.EAGER; + +/** + * Defines a single-valued association to another entity that has + * one-to-one multiplicity. It is not normally necessary to specify + * the associated target entity explicitly since it can usually be + * inferred from the type of the object being referenced. If the relationship is + * bidirectional, the non-owning side must use the mappedBy element of + * the OneToOne annotation to specify the relationship field or + * property of the owning side. + * + *

    The OneToOne annotation may be used within an + * embeddable class to specify a relationship from the embeddable + * class to an entity class. If the relationship is bidirectional and + * the entity containing the embeddable class is on the owning side of + * the relationship, the non-owning side must use the + * mappedBy element of the OneToOne + * annotation to specify the relationship field or property of the + * embeddable class. The dot (".") notation syntax must be used in the + * mappedBy element to indicate the relationship attribute within the + * embedded attribute. The value of each identifier used with the dot + * notation is the name of the respective embedded field or property. + * + *

    + *    Example 1: One-to-one association that maps a foreign key column
    + *
    + *    // On Customer class:
    + *
    + *    @OneToOne(optional=false)
    + *    @JoinColumn(
    + *    	name="CUSTREC_ID", unique=true, nullable=false, updatable=false)
    + *    public CustomerRecord getCustomerRecord() { return customerRecord; }
    + *
    + *    // On CustomerRecord class:
    + *
    + *    @OneToOne(optional=false, mappedBy="customerRecord")
    + *    public Customer getCustomer() { return customer; }
    + *
    + *
    + *    Example 2: One-to-one association that assumes both the source and target share the same primary key values.
    + *
    + *    // On Employee class:
    + *
    + *    @Entity
    + *    public class Employee {
    + *    	@Id Integer id;
    + *
    + *    	@OneToOne @MapsId
    + *    	EmployeeInfo info;
    + *    	...
    + *    }
    + *
    + *    // On EmployeeInfo class:
    + *
    + *    @Entity
    + *    public class EmployeeInfo {
    + *    	@Id Integer id;
    + *    	...
    + *    }
    + *
    + *
    + *    Example 3: One-to-one association from an embeddable class to another entity.
    + *
    + *    @Entity
    + *    public class Employee {
    + *       @Id int id;
    + *       @Embedded LocationDetails location;
    + *       ...
    + *    }
    + *
    + *    @Embeddable
    + *    public class LocationDetails {
    + *       int officeNumber;
    + *       @OneToOne ParkingSpot parkingSpot;
    + *       ...
    + *    }
    + *
    + *    @Entity
    + *    public class ParkingSpot {
    + *       @Id int id;
    + *       String garage;
    + *       @OneToOne(mappedBy="location.parkingSpot") Employee assignedTo;
    + *        ...
    + *    }
    + *
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface OneToOne { + + /** + * (Optional) The entity class that is the target of + * the association. + * + *

    Defaults to the type of the field or property + * that stores the association. + */ + Class targetEntity() default void.class; + + /** + * (Optional) The operations that must be cascaded to + * the target of the association. + * + *

    By default no operations are cascaded. + */ + CascadeType[] cascade() default {}; + + /** + * (Optional) Whether the association should be lazily + * loaded or must be eagerly fetched. The EAGER + * strategy is a requirement on the persistence provider runtime that + * the associated entity must be eagerly fetched. The LAZY + * strategy is a hint to the persistence provider runtime. + */ + FetchType fetch() default EAGER; + + /** + * (Optional) Whether the association is optional. If set + * to false then a non-null relationship must always exist. + */ + boolean optional() default true; + + /** (Optional) The field that owns the relationship. This + * element is only specified on the inverse (non-owning) + * side of the association. + */ + String mappedBy() default ""; + + + /** + * (Optional) Whether to apply the remove operation to entities that have + * been removed from the relationship and to cascade the remove operation to + * those entities. + * @since Java Persistence 2.0 + */ + boolean orphanRemoval() default false; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/OptimisticLockException.java b/fine-jpa/src/com/fr/third/javax/persistence/OptimisticLockException.java new file mode 100644 index 000000000..8f48d235f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/OptimisticLockException.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + + +/** + * Thrown by the persistence provider when an optimistic locking conflict + * occurs. This exception may be thrown as part of an API call, a flush or at + * commit time. The current transaction, if one is active, will be marked for + * rollback. + * + * @see EntityManager#find(Class, Object, LockModeType) + * @see EntityManager#find(Class, Object, LockModeType, java.util.Map) + * @see EntityManager#lock(Object, LockModeType) + * @see EntityManager#lock(Object, LockModeType, java.util.Map) + * + * @since Java Persistence 1.0 + */ +public class OptimisticLockException extends PersistenceException { + + /** + * The object that caused the exception + */ + Object entity; + + /** + * Constructs a new OptimisticLockException exception with + * null as its detail message. + */ + public OptimisticLockException() { + super(); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message. + * + * @param message + * the detail message. + */ + public OptimisticLockException(String message) { + super(message); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message and cause. + * + * @param message + * the detail message. + * @param cause + * the cause. + */ + public OptimisticLockException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified cause. + * + * @param cause + * the cause. + */ + public OptimisticLockException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified entity. + * + * @param entity + * the entity. + */ + public OptimisticLockException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new OptimisticLockException exception with the + * specified detail message, cause, and entity. + * + * @param message + * the detail message. + * @param cause + * the cause. + * @param entity + * the entity. + */ + public OptimisticLockException(String message, Throwable cause, Object entity) { + super(message, cause); + this.entity = entity; + } + + /** + * Returns the entity that caused this exception. + * + * @return the entity. + */ + public Object getEntity() { + return this.entity; + } + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/OrderBy.java b/fine-jpa/src/com/fr/third/javax/persistence/OrderBy.java new file mode 100644 index 000000000..f70d83010 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/OrderBy.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the ordering of the elements of a collection valued + * association or element collection at the point when the association + * or collection is retrieved. + * + *

    The syntax of the value ordering element is an + * orderby_list, as follows: + * + *

    + *    orderby_list::= orderby_item [,orderby_item]*
    + *    orderby_item::= [property_or_field_name] [ASC | DESC]
    + * 
    + * + *

    If ASC or DESC is not specified, + * ASC (ascending order) is assumed. + * + *

    If the ordering element is not specified for an entity association, + * ordering by the primary key of the associated entity is assumed. + * + *

    The property or field name must correspond to that of a + * persistent property or field of the associated class or embedded class + * within it. The properties or fields used in the ordering must correspond to + * columns for which comparison operators are supported. + * + *

    The dot (".") notation is used to refer to an attribute within an + * embedded attribute. The value of each identifier used with the dot + * notation is the name of the respective embedded field or property. + * + *

    The OrderBy annotation may be applied to an element + * collection. When OrderBy is applied to an element collection of + * basic type, the ordering will be by value of the basic objects and + * the property or field name is not used. When specifying an ordering + * over an element collection of embeddable type, the dot notation + * must be used to specify the attribute or attributes that determine + * the ordering. + * + *

    The OrderBy annotation is not used when an order + * column is specified. + * + * + *

    + *    Example 1:
    + *
    + *    @Entity
    + *    public class Course {
    + *       ...
    + *       @ManyToMany
    + *       @OrderBy("lastname ASC")
    + *       public List<Student> getStudents() {...};
    + *       ...
    + *    }
    + *
    + *    Example 2:
    + *
    + *    @Entity
    + *    public class Student {
    + *       ...
    + *       @ManyToMany(mappedBy="students")
    + *       @OrderBy // ordering by primary key is assumed
    + *       public List<Course> getCourses() {...};
    + *       ...
    + *    }
    + *
    + *    Example 3:
    + *
    + *    @Entity
    + *    public class Person {
    + *         ...
    + *       @ElementCollection
    + *       @OrderBy("zipcode.zip, zipcode.plusFour")
    + *       public Set<Address> getResidences() {...};
    + *       ...
    + *    }
    + *
    + *    @Embeddable
    + *    public class Address {
    + *       protected String street;
    + *       protected String city;
    + *       protected String state;
    + *       @Embedded protected Zipcode zipcode;
    + *    }
    + *
    + *    @Embeddable
    + *    public class Zipcode {
    + *       protected String zip;
    + *       protected String plusFour;
    + *    }
    + * 
    + * + * @see OrderColumn + * + * @since Java Persistence 1.0 + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface OrderBy { + + /** + * An orderby_list. Specified as follows: + * + *
    +    *    orderby_list::= orderby_item [,orderby_item]*
    +    *    orderby_item::= [property_or_field_name] [ASC | DESC]
    +    * 
    + * + *

    If ASC or DESC is not specified, + * ASC (ascending order) is assumed. + * + *

    If the ordering element is not specified, ordering by + * the primary key of the associated entity is assumed. + */ + String value() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/OrderColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/OrderColumn.java new file mode 100644 index 000000000..94a656e34 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/OrderColumn.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a column that is used to maintain the persistent order of + * a list. The persistence provider is responsible for maintaining the + * order upon retrieval and in the database. The persistence provider + * is responsible for updating the ordering upon flushing to the + * database to reflect any insertion, deletion, or reordering + * affecting the list. + * + *

    The OrderColumn annotation is specified on a + * OneToMany or ManyToMany relationship or on an element + * collection. The OrderColumn annotation is specified on + * the side of the relationship that references the collection that is + * to be ordered. The order column is not visible as part of the state + * of the entity or embeddable class. + * + *

    The {@link OrderBy} annotation should be used for ordering that + * is visible as persistent state and maintained by the + * application. The OrderBy annotation is not used when + * OrderColumn is specified. + * + *

    The order column must be of integral type. The persistence + * provider maintains a contiguous (non-sparse) ordering of the values + * of the order column when updating the association or element collection. + * The order column value for the first element is 0. + * + *

    + *
    + *    Example:
    + *
    + *    @Entity
    + *    public class CreditCard {
    + *
    + *       @Id long ccNumber;
    + *
    + *       @OneToMany  // unidirectional
    + *       @OrderColumn
    + *       List<CardTransaction> transactionHistory;
    + *       ...
    + *    }
    + *
    + * 
    + * + * @see OrderBy + * + * @since Java Persistence 2.0 + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface OrderColumn { + + /** (Optional) The name of the ordering column. + * Defaults to the concatenation of the name of the + * referencing property or field; "_"; "ORDER". + */ + String name() default ""; + + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default true; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. Defaults to generated SQL to create a column of the inferred type. + */ + String columnDefinition() default ""; +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Parameter.java b/fine-jpa/src/com/fr/third/javax/persistence/Parameter.java new file mode 100644 index 000000000..f70cf426a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Parameter.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Type for query parameter objects. + * @param the type of the parameter + * + * @see Query + * @see TypedQuery + * + * @since Java Persistence 2.0 + */ +public interface Parameter { + + /** + * Return the parameter name, or null if the parameter is + * not a named parameter or no name has been assigned. + * @return parameter name + */ + String getName(); + + /** + * Return the parameter position, or null if the parameter + * is not a positional parameter. + * @return position of parameter + */ + Integer getPosition(); + + /** + * Return the Java type of the parameter. Values bound to the + * parameter must be assignable to this type. + * This method is required to be supported for criteria queries + * only. Applications that use this method for Java + * Persistence query language queries and native queries will + * not be portable. + * @return the Java type of the parameter + * @throws IllegalStateException if invoked on a parameter + * obtained from a Java persistence query language + * query or native query when the implementation does + * not support this use + */ + Class getParameterType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ParameterMode.java b/fine-jpa/src/com/fr/third/javax/persistence/ParameterMode.java new file mode 100644 index 000000000..1e03a27c9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ParameterMode.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Specifies the mode of a parameter of a stored procedure query. + * + * @since Java Persistence 2.1 + * + * @see StoredProcedureQuery + * @see StoredProcedureParameter + */ +public enum ParameterMode { + /** + * Stored procedure input parameter + */ + IN, + /** + * Stored procedure input/output parameter + */ + INOUT, + /** + * Stored procedure output parameter + */ + OUT, + /** + * Stored procedure reference cursor parameter. + */ + REF_CURSOR +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Persistence.java b/fine-jpa/src/com/fr/third/javax/persistence/Persistence.java new file mode 100644 index 000000000..7b41b75c7 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Persistence.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import com.fr.third.javax.persistence.spi.LoadState; +import com.fr.third.javax.persistence.spi.PersistenceProvider; +import com.fr.third.javax.persistence.spi.PersistenceProviderResolverHolder; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Bootstrap class that provides access to an EntityManagerFactory. + */ +public class Persistence { + + @Deprecated + public static final String PERSISTENCE_PROVIDER = "com.fr.third.javax.persistence.spi.PeristenceProvider"; + + @Deprecated + protected static final Set providers = new HashSet(); + + /** + * Create and return an EntityManagerFactory for the named persistence unit. + * + * @param persistenceUnitName The name of the persistence unit + * + * @return The factory that creates EntityManagers configured according to the specified persistence unit + */ + public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) { + return createEntityManagerFactory( persistenceUnitName, null ); + } + + /** + * Create and return an EntityManagerFactory for the named persistence unit using the given properties. + * + * @param persistenceUnitName The name of the persistence unit + * @param properties Additional properties to use when creating the factory. The values of these properties override + * any values that may have been configured elsewhere + * + * @return The factory that creates EntityManagers configured according to the specified persistence unit + */ + public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) { + EntityManagerFactory emf = null; + List providers = getProviders(); + for ( PersistenceProvider provider : providers ) { + emf = provider.createEntityManagerFactory( persistenceUnitName, properties ); + if ( emf != null ) { + break; + } + } + if ( emf == null ) { + throw new PersistenceException( "No Persistence provider for EntityManager named " + persistenceUnitName ); + } + return emf; + } + + private static List getProviders() { + return PersistenceProviderResolverHolder + .getPersistenceProviderResolver() + .getPersistenceProviders(); + } + + /** + * Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties + * + * Called when schema generation is to occur as a separate phase from creation of the entity manager factory. + * + * @param persistenceUnitName the name of the persistence unit + * @param properties properties for schema generation; these may also contain provider-specific properties. The + * values of these properties override any values that may have been configured elsewhere. + * + * @throws PersistenceException if insufficient or inconsistent configuration information is provided or if schema + * generation otherwise fails. + */ + public static void generateSchema(String persistenceUnitName, Map properties) { + List providers = getProviders(); + for ( PersistenceProvider provider : providers ) { + final boolean generated = provider.generateSchema( persistenceUnitName, properties ); + if ( generated ) { + return; + } + } + + throw new PersistenceException( + "No persistence provider found for schema generation for persistence-unit named " + persistenceUnitName + ); + } + + /** + * @return Returns a PersistenceUtil instance. + */ + public static PersistenceUtil getPersistenceUtil() { + return util; + } + + private static PersistenceUtil util = + //TODO add an Hibernate specific optimization + new PersistenceUtil() { + public boolean isLoaded(Object entity, String attributeName) { + List providers = Persistence.getProviders(); + for ( PersistenceProvider provider : providers ) { + final LoadState state = provider.getProviderUtil().isLoadedWithoutReference( entity, attributeName ); + if ( state == LoadState.UNKNOWN ) continue; + return state == LoadState.LOADED; + } + for ( PersistenceProvider provider : providers ) { + final LoadState state = provider.getProviderUtil().isLoadedWithReference( entity, attributeName ); + if ( state == LoadState.UNKNOWN ) continue; + return state == LoadState.LOADED; + } + return true; + } + + public boolean isLoaded(Object object) { + List providers = Persistence.getProviders(); + for ( PersistenceProvider provider : providers ) { + final LoadState state = provider.getProviderUtil().isLoaded( object ); + if ( state == LoadState.UNKNOWN ) continue; + return state == LoadState.LOADED; + } + return true; + } + }; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContext.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContext.java new file mode 100644 index 000000000..407fd7edc --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContext.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Expresses a dependency on a container-managed {@link EntityManager} and its + * associated persistence context. + * + * @since Java Persistence 1.0 + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface PersistenceContext { + + /** + * (Optional) The name by which the entity manager is to be accessed in the + * environment referencing context; not needed when dependency + * injection is used. + */ + String name() default ""; + + /** + * (Optional) The name of the persistence unit as defined in the + * persistence.xml file. If the unitName element is + * specified, the persistence unit for the entity manager that is + * accessible in JNDI must have the same name. + */ + String unitName() default ""; + + /** + * (Optional) Specifies whether a transaction-scoped persistence context + * or an extended persistence context is to be used. + */ + PersistenceContextType type() default PersistenceContextType.TRANSACTION; + + /** + * (Optional) Specifies whether the persistence context is always automatically synchronized with the current + * JTA transaction or whether the persistence context must be explicitly joined to the current JTA transaction by + * means of the EntityManager joinTransaction method + * + * @since Java Persistence 2.1 + */ + SynchronizationType synchronization() default SynchronizationType.SYNCHRONIZED; + + /** + * (Optional) Properties for the container or persistence + * provider. Vendor specific properties may be included in this + * set of properties. Properties that are not recognized by + * a vendor are ignored. + */ + PersistenceProperty[] properties() default {}; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContextType.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContextType.java new file mode 100644 index 000000000..7c5c0d882 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContextType.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Specifies whether a transaction-scoped or extended + * persistence context is to be used in {@link PersistenceContext}. + * If not specified, a transaction-scoped persistence context is used. + * + * @since Java Persistence 1.0 + */ +public enum PersistenceContextType { + + /** + * Transaction-scoped persistence context + */ + TRANSACTION, + + /** + * Extended persistence context + */ + EXTENDED +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContexts.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContexts.java new file mode 100644 index 000000000..031407230 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceContexts.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Declares one or more {@link PersistenceContext} annotations. + * It is used to express a dependency on container-managed + * entity manager persistence contexts. + * + *@see PersistenceContext + * + * @since Java Persistence 1.0 + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface PersistenceContexts { + + /** (Required) One or more PersistenceContext annotations. */ + PersistenceContext[] value(); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceException.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceException.java new file mode 100644 index 000000000..08ef90669 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceException.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when a problem occurs. + * All instances of PersistenceException except for instances of + * {@link NoResultException}, {@link NonUniqueResultException}, + * {@link LockTimeoutException}, and {@link QueryTimeoutException} will cause + * the current transaction, if one is active, to be marked for rollback. + * + * @since Java Persistence 1.0 + */ +public class PersistenceException extends RuntimeException { + /** + * Constructs a new PersistenceException exception + * with null as its detail message. + */ + public PersistenceException() { + super(); + } + + /** + * Constructs a new PersistenceException exception + * with the specified detail message. + * + * @param message the detail message. + */ + public PersistenceException(String message) { + super( message ); + } + + /** + * Constructs a new PersistenceException exception + * with the specified detail message and cause. + * + * @param message the detail message. + * @param cause the cause. + */ + public PersistenceException(String message, Throwable cause) { + super( message, cause ); + } + + /** + * Constructs a new PersistenceException exception + * with the specified cause. + * + * @param cause the cause. + */ + public PersistenceException(Throwable cause) { + super(cause); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceProperty.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceProperty.java new file mode 100644 index 000000000..fcb987bde --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceProperty.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Describes a single container or persistence provider property. Used in {@link + * PersistenceContext}. + *

    + * Vendor specific properties may be included in the set of + * properties, and are passed to the persistence provider by the + * container when the entity manager is created. Properties that + * are not recognized by a vendor will be ignored. + * + * @since Java Persistence 1.0 + */ +@Target({ }) +@Retention(RUNTIME) +public @interface PersistenceProperty { + /** + * The name of the property + */ + String name(); + + /** + * The value of the property + */ + String value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnit.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnit.java new file mode 100644 index 000000000..4ee49ea55 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnit.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Expresses a dependency on an {@link EntityManagerFactory} and its + * associated persistence unit. + * + * @since Java Persistence 1.0 + */ +@Target({ TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface PersistenceUnit { + /** + * (Optional) The name by which the entity manager factory is to be accessed + * in the environment referencing context; not needed when + * dependency injection is used. + */ + String name() default ""; + + /** + * (Optional) The name of the persistence unit as defined in the + * persistence.xml file. If specified, the + * persistence unit for the entity manager factory that is + * accessible in JNDI must have the same name. + */ + String unitName() default ""; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnitUtil.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnitUtil.java new file mode 100644 index 000000000..6bb96f09b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnitUtil.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Utility interface between the application and the persistence + * provider managing the persistence unit. + *

    + *

    The methods of this interface should only be invoked on entity + * instances obtained from or managed by entity managers for this + * persistence unit or on new entity instances. + * + * @since Java Persistence 2.0 + */ +public interface PersistenceUnitUtil extends PersistenceUtil { + /** + * Determine the load state of a given persistent attribute + * of an entity belonging to the persistence unit. + * + * @param entity entity instance containing the attribute + * @param attributeName name of attribute whose load state is + * to be determined + * + * @return false if entity's state has not been loaded or if + * the attribute state has not been loaded, else true + */ + public boolean isLoaded(Object entity, String attributeName); + + /** + * Determine the load state of an entity belonging to the + * persistence unit. This method can be used to determine the + * load state of an entity passed as a reference. An entity is + * considered loaded if all attributes for which + * FetchType.EAGER has been specified have been + * loaded. + *

    The isLoaded(Object, String) method + * should be used to determine the load state of an attribute. + * Not doing so might lead to unintended loading of state. + * + * @param entity entity instance whose load state is to be determined + * + * @return false if the entity has not been loaded, else true + */ + public boolean isLoaded(Object entity); + + /** + * Return the id of the entity. + * A generated id is not guaranteed to be available until after + * the database insert has occurred. + * Returns null if the entity does not yet have an id. + * + * @param entity entity instance + * + * @return id of the entity + * + * @throws IllegalArgumentException if the object is found not + * to be an entity + */ + public Object getIdentifier(Object entity); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnits.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnits.java new file mode 100644 index 000000000..7d021b7cf --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUnits.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Declares one or more {@link PersistenceUnit} annotations. + * + * @since Java Persistence 1.0 + */ + +@Target({ TYPE }) +@Retention(RUNTIME) +public @interface PersistenceUnits { + /** + * (Required) One or more {@link PersistenceUnit} annotations. + */ + PersistenceUnit[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUtil.java b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUtil.java new file mode 100644 index 000000000..a75f090ad --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PersistenceUtil.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Utility interface between the application and the persistence + * provider(s). + *

    + * The PersistenceUtil interface instance obtained from the + * {@link Persistence} class is used to determine the load state of an + * entity or entity attribute regardless of which persistence + * provider in the environment created the entity. + * + * @since Java Persistence 2.0 + */ +public interface PersistenceUtil { + /** + * Determine the load state of a given persistent attribute. + * + * @param entity entity containing the attribute + * @param attributeName name of attribute whose load state is + * to be determined + * + * @return false if entity's state has not been loaded or + * if the attribute state has not been loaded, else true + */ + public boolean isLoaded(Object entity, String attributeName); + + /** + * Determine the load state of an entity. + * This method can be used to determine the load state + * of an entity passed as a reference. An entity is + * considered loaded if all attributes for which + * FetchType.EAGER has been specified have been loaded. + *

    The isLoaded(Object, String) method should be used to + * determine the load state of an attribute. + * Not doing so might lead to unintended loading of state. + * + * @param entity whose load state is to be determined + * + * @return false if the entity has not been loaded, else true + */ + public boolean isLoaded(Object entity); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockException.java b/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockException.java new file mode 100644 index 000000000..bbabb09f2 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockException.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when an pessimistic locking conflict + * occurs. This exception may be thrown as part of an API call, a flush or at + * commit time. The current transaction, if one is active, will be marked for + * rollback. + * + * @since Java Persistence 2.0 + */ +public class PessimisticLockException extends PersistenceException { + /** + * The object that caused the exception + */ + Object entity; + + /** + * Constructs a new PessimisticLockException exception + * with null as its detail message. + */ + public PessimisticLockException() { + super(); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message. + * + * @param message the detail message. + */ + public PessimisticLockException(String message) { + super( message ); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message and cause. + * + * @param message the detail message. + * @param cause the cause. + */ + public PessimisticLockException(String message, Throwable cause) { + super( message, cause ); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified cause. + * + * @param cause the cause. + */ + public PessimisticLockException(Throwable cause) { + super( cause ); + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified entity. + * + * @param entity the entity. + */ + public PessimisticLockException(Object entity) { + this.entity = entity; + } + + /** + * Constructs a new PessimisticLockException exception + * with the specified detail message, cause, and entity. + * + * @param message the detail message. + * @param cause the cause. + * @param entity the entity. + */ + public PessimisticLockException(String message, Throwable cause, Object entity) { + super( message, cause ); + this.entity = entity; + } + + /** + * Returns the entity that caused this exception. + * + * @return the entity. + */ + public Object getEntity() { + return this.entity; + } +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockScope.java b/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockScope.java new file mode 100644 index 000000000..4cdce4bdc --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PessimisticLockScope.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Defines the values of the com.fr.third.javax.persistence.lock.scope + * property for pessimistic locking. This property may be passed as + * an argument to the methods of the {@link EntityManager}, + * {@link Query}, and {@link TypedQuery} interfaces that + * allow lock modes to be specified or used with the + * {@link NamedQuery} annotation. + * + * @since Java Persistence 2.0 + */ +public enum PessimisticLockScope { + /** + * This value defines the default behavior for pessimistic locking. + *

    + * The persistence provider must lock the database row(s) that + * correspond to the non-collection-valued persistent state of + * that instance. If a joined inheritance strategy is used, or if + * the entity is otherwise mapped to a secondary table, this + * entails locking the row(s) for the entity instance in the + * additional table(s). Entity relationships for which the locked + * entity contains the foreign key will also be locked, but not + * the state of the referenced entities (unless those entities are + * explicitly locked). Element collections and relationships for + * which the entity does not contain the foreign key (such as + * relationships that are mapped to join tables or unidirectional + * one-to-many relationships for which the target entity contains + * the foreign key) will not be locked by default. + */ + NORMAL, + + /** + * In addition to the behavior for + * PessimisticLockScope.NORMAL, element collections + * and relationships owned by the entity that are contained in + * join tables will be locked if the + * com.fr.third.javax.persistence.lock.scope property is specified + * with a value of PessimisticLockScope.EXTENDED. + * The state of entities referenced by such relationships will not + * be locked (unless those entities are explicitly locked). + * Locking such a relationship or element collection generally locks only + * the rows in the join table or collection table for that + * relationship or collection. This means that phantoms will be + * possible. + */ + EXTENDED +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PostLoad.java b/fine-jpa/src/com/fr/third/javax/persistence/PostLoad.java new file mode 100644 index 000000000..e4abd293b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PostLoad.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PostLoad { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PostPersist.java b/fine-jpa/src/com/fr/third/javax/persistence/PostPersist.java new file mode 100644 index 000000000..00304bdbb --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PostPersist.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PostPersist { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PostRemove.java b/fine-jpa/src/com/fr/third/javax/persistence/PostRemove.java new file mode 100644 index 000000000..a4f35248e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PostRemove.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PostRemove { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PostUpdate.java b/fine-jpa/src/com/fr/third/javax/persistence/PostUpdate.java new file mode 100644 index 000000000..93939f1b9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PostUpdate.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PostUpdate { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PrePersist.java b/fine-jpa/src/com/fr/third/javax/persistence/PrePersist.java new file mode 100644 index 000000000..b85fdaa6e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PrePersist.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PrePersist { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PreRemove.java b/fine-jpa/src/com/fr/third/javax/persistence/PreRemove.java new file mode 100644 index 000000000..f4560141b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PreRemove.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PreRemove { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PreUpdate.java b/fine-jpa/src/com/fr/third/javax/persistence/PreUpdate.java new file mode 100644 index 000000000..6a235a8f8 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PreUpdate.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to specify callback methods for the corresponding + * lifecycle event. This annotation may be applied to methods + * of an entity class, a mapped superclass, or a callback + * listener class. + * + * @since Java Persistence 1.0 + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface PreUpdate { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumn.java b/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumn.java new file mode 100644 index 000000000..e7b7115a9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumn.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a primary key column that is used as a foreign key to + * join to another table. + *

    + * It is used to join the primary table of an entity subclass + * in the {@link InheritanceType#JOINED JOINED} mapping strategy + * to the primary table of its superclass; it is used within a + * {@link SecondaryTable} annotation to join a secondary table + * to a primary table; and it may be used in a {@link OneToOne} + * mapping in which the primary key of the referencing entity + * is used as a foreign key to the referenced entity. + *

    + * If no PrimaryKeyJoinColumn annotation is + * specified for a subclass in the JOINED + * mapping strategy, the foreign key columns are assumed + * to have the same names as the primary key columns of the + * primary table of the superclass. + * + *

    + *
    + *    Example: Customer and ValuedCustomer subclass
    + *
    + *    @Entity
    + *    @Table(name="CUST")
    + *    @Inheritance(strategy=JOINED)
    + *    @DiscriminatorValue("CUST")
    + *    public class Customer { ... }
    + *
    + *    @Entity
    + *    @Table(name="VCUST")
    + *    @DiscriminatorValue("VCUST")
    + *    @PrimaryKeyJoinColumn(name="CUST_ID")
    + *    public class ValuedCustomer extends Customer { ... }
    + * 
    + * + * @see SecondaryTable + * @see Inheritance + * @see OneToOne + * @since Java Persistence 1.0 + */ +@Target({ TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface PrimaryKeyJoinColumn { + + /** + * (Optional) The name of the primary key column of the current table. + *

    + * Defaults to the same name as the primary key column of the primary + * table of the superclass (JOINED mapping strategy); the same + * name as the primary key column of the primary table + * (SecondaryTable mapping); or the same name as the + * primary key column for the table for the referencing entity + * (OneToOne mapping). + */ + String name() default ""; + + /** + * (Optional) The name of the primary key column of the table + * being joined to. + *

    + * Defaults to the same name as the primary key column of the primary table + * of the superclass (JOINED mapping strategy); the same name + * as the primary key column of the primary table + * (SecondaryTable mapping); or the same name as the + * primary key column for the table for the referencing entity + * (OneToOne mapping). + */ + String referencedColumnName() default ""; + + /** + * (Optional) The SQL fragment that is used when generating the + * DDL for the column. This should not be specified for a + * OneToOne primary key association. + *

    + * Defaults to the generated SQL to create a column of the inferred type. + */ + String columnDefinition() default ""; + + /** + * (Optional) The foreign key constraint specification for the join column. This is used only if table generation + * is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumns.java b/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumns.java new file mode 100644 index 000000000..d320049ff --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/PrimaryKeyJoinColumns.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Groups {@link PrimaryKeyJoinColumn} annotations. + * It is used to map composite foreign keys. + * + *

    + *    Example: ValuedCustomer subclass
    + *
    + *    @Entity
    + *    @Table(name="VCUST")
    + *    @DiscriminatorValue("VCUST")
    + *    @PrimaryKeyJoinColumns({
    + *        @PrimaryKeyJoinColumn(name="CUST_ID",
    + *            referencedColumnName="ID"),
    + *        @PrimaryKeyJoinColumn(name="CUST_TYPE",
    + *            referencedColumnName="TYPE")
    + *    })
    + *    public class ValuedCustomer extends Customer { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface PrimaryKeyJoinColumns { + /** + * One or more PrimaryKeyJoinColumn annotations. + */ + PrimaryKeyJoinColumn[] value(); + + /** + * (Optional) The foreign key constraint specification for the join columns. This is used only if table generation + * is in effect. Default is provider defined. + * + * @return The foreign key specification + */ + ForeignKey foreignKey() default @ForeignKey(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Query.java b/fine-jpa/src/com/fr/third/javax/persistence/Query.java new file mode 100644 index 000000000..4c9afe4c2 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Query.java @@ -0,0 +1,526 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Interface used to control query execution. + * + * @see TypedQuery + * @see Parameter + * @since Java Persistence 1.0 + */ +public interface Query { + + /** + * Execute a SELECT query and return the query results + * as an untyped List. + * + * @return a list of the results + * + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode has + * been set and there is no transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + List getResultList(); + + /** + * Execute a SELECT query that returns a single untyped result. + * + * @return the result + * + * @throws NoResultException if there is no result + * @throws NonUniqueResultException if more than one result + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode has + * been set and there is no transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + Object getSingleResult(); + + /** + * Execute an update or delete statement. + * + * @return the number of entities updated or deleted + * + * @throws IllegalStateException if called for a Java + * Persistence query language SELECT statement or for + * a criteria query + * @throws TransactionRequiredException if there is + * no transaction + * @throws QueryTimeoutException if the statement execution + * exceeds the query timeout value set and only + * the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + int executeUpdate(); + + /** + * Set the maximum number of results to retrieve. + * + * @param maxResult maximum number of results to retrieve + * + * @return the same query instance + * + * @throws IllegalArgumentException if the argument is negative + */ + Query setMaxResults(int maxResult); + + /** + * The maximum number of results the query object was set to + * retrieve. Returns Integer.MAX_VALUE if setMaxResults was not + * applied to the query object. + * + * @return maximum number of results + * + * @since Java Persistence 2.0 + */ + int getMaxResults(); + + /** + * Set the position of the first result to retrieve. + * + * @param startPosition position of the first result, + * numbered from 0 + * + * @return the same query instance + * + * @throws IllegalArgumentException if the argument is negative + */ + Query setFirstResult(int startPosition); + + /** + * The position of the first result the query object was set to + * retrieve. Returns 0 if setFirstResult was not applied to the + * query object. + * + * @return position of the first result + * + * @since Java Persistence 2.0 + */ + int getFirstResult(); + + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use and the locking mechanisms used by the provider, + * this hint may or may not be observed. + * + * @param hintName name of the property or hint + * @param value value for the property or hint + * + * @return the same query instance + * + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + Query setHint(String hintName, Object value); + + /** + * Get the properties and hints and associated values that are + * in effect for the query instance. + * + * @return query properties and hints + * + * @since Java Persistence 2.0 + */ + Map getHints(); + + /** + * Bind the value of a Parameter object. + * + * @param param parameter object + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter + * does not correspond to a parameter of the + * query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + * @since Java Persistence 2.0 + */ + Query setParameter(Parameter param, Date value, + TemporalType temporalType); + + /** + * Bind an argument to a named parameter. + * + * @param name parameter name + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the argument is of incorrect type + */ + Query setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + Query setParameter(String name, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + Query setParameter(String name, Date value, + TemporalType temporalType); + + /** + * Bind an argument to a positional parameter. + * + * @param position position + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the + * query or if the argument is of incorrect type + */ + Query setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + Query setParameter(int position, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + Query setParameter(int position, Date value, + TemporalType temporalType); + + /** + * Get the parameter objects corresponding to the declared + * parameters of the query. + * Returns empty set if the query has no parameters. + * This method is not required to be supported for native + * queries. + * + * @return set of the parameter objects + * + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Set> getParameters(); + + /** + * Get the parameter object corresponding to the declared + * parameter of the given name. + * This method is not required to be supported for native + * queries. + * + * @param name parameter name + * + * @return parameter object + * + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(String name); + + /** + * Get the parameter object corresponding to the declared + * parameter of the given name and type. + * This method is required to be supported for criteria queries + * only. + * + * @param name parameter name + * @param type type + * + * @return parameter object + * + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist or is not assignable + * to the type + * @throws IllegalStateException if invoked on a native + * query or Java Persistence query language query when + * the implementation does not support this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(String name, Class type); + + /** + * Get the parameter object corresponding to the declared + * positional parameter with the given position. + * This method is not required to be supported for native + * queries. + * + * @param position position + * + * @return parameter object + * + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist + * @throws IllegalStateException if invoked on a native + * query when the implementation does not support + * this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(int position); + + /** + * Get the parameter object corresponding to the declared + * positional parameter with the given position and type. + * This method is not required to be supported by the provider. + * + * @param position position + * @param type type + * + * @return parameter object + * + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist or is not assignable + * to the type + * @throws IllegalStateException if invoked on a native + * query or Java Persistence query language query when + * the implementation does not support this use + * @since Java Persistence 2.0 + */ + Parameter getParameter(int position, Class type); + + /** + * Return a boolean indicating whether a value has been bound + * to the parameter. + * + * @param param parameter object + * + * @return boolean indicating whether parameter has been bound + * + * @since Java Persistence 2.0 + */ + boolean isBound(Parameter param); + + /** + * Return the value bound to the parameter. + * + * @param param parameter object + * + * @return parameter value + * + * @throws IllegalArgumentException if the parameter is not + * a parameter of the query + * @throws IllegalStateException if the parameter has not been + * been bound + * @since Java Persistence 2.0 + */ + T getParameterValue(Parameter param); + + /** + * Return the value bound to the named parameter. + * + * @param name parameter name + * + * @return parameter value + * + * @throws IllegalStateException if the parameter has not been + * been bound + * @throws IllegalArgumentException if the parameter of the + * specified name does not exist + * @since Java Persistence 2.0 + */ + Object getParameterValue(String name); + + /** + * Return the value bound to the positional parameter. + * + * @param position position + * + * @return parameter value + * + * @throws IllegalStateException if the parameter has not been + * been bound + * @throws IllegalArgumentException if the parameter with the + * specified position does not exist + * @since Java Persistence 2.0 + */ + Object getParameterValue(int position); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * + * @param flushMode flush mode + * + * @return the same query instance + */ + Query setFlushMode(FlushModeType flushMode); + + /** + * Get the flush mode in effect for the query execution. + * If a flush mode has not been set for the query object, + * returns the flush mode in effect for the entity manager. + * + * @return flush mode + * + * @since Java Persistence 2.0 + */ + FlushModeType getFlushMode(); + + /** + * Set the lock mode type to be used for the query execution. + * + * @param lockMode lock mode + * + * @return the same query instance + * + * @throws IllegalStateException if the query is found not to be + * a Java Persistence query language SELECT query + * or a Criteria API query + * @since Java Persistence 2.0 + */ + Query setLockMode(LockModeType lockMode); + + /** + * Get the current lock mode for the query. + * + * @return lock mode + * + * @throws IllegalStateException if the query is found not to be + * a Java Persistence query language SELECT query or + * a Criteria API query + * @since Java Persistence 2.0 + */ + LockModeType getLockMode(); + + /** + * Return an object of the specified type to allow access to + * the provider-specific API. If the provider's query + * implementation does not support the specified class, the + * PersistenceException is thrown. + * + * @param cls the class of the object to be returned. This is + * normally either the underlying query + * implementation class or an interface that it + * implements. + * + * @return an instance of the specified class + * + * @throws PersistenceException if the provider does not support + * the call + * @since Java Persistence 2.0 + */ + T unwrap(Class cls); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/QueryHint.java b/fine-jpa/src/com/fr/third/javax/persistence/QueryHint.java new file mode 100644 index 000000000..42fb2e909 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/QueryHint.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to supply a query property or hint to the {@link NamedQuery} or {@link + * NamedNativeQuery} annotation. + * + *

    Vendor-specific hints that are not recognized by a provider are ignored. + * + * @since Java Persistence 1.0 + */ +@Target({ }) +@Retention(RUNTIME) +public @interface QueryHint { + /** + * Name of the hint. + */ + String name(); + + /** + * Value of the hint. + */ + String value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/QueryTimeoutException.java b/fine-jpa/src/com/fr/third/javax/persistence/QueryTimeoutException.java new file mode 100644 index 000000000..c79f79f6d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/QueryTimeoutException.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when a query times out + * and only the statement is rolled back. + * The current transaction, if one is active, will be not + * be marked for rollback. + * + * @since Java Persistence 2.0 + */ +public class QueryTimeoutException extends PersistenceException { + /** + * The query object that caused the exception + */ + Query query; + + /** + * Constructs a new QueryTimeoutException exception + * with null as its detail message. + */ + public QueryTimeoutException() { + super(); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message. + * + * @param message the detail message. + */ + public QueryTimeoutException(String message) { + super( message ); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message and cause. + * + * @param message the detail message. + * @param cause the cause. + */ + public QueryTimeoutException(String message, Throwable cause) { + super( message, cause ); + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified cause. + * + * @param cause the cause. + */ + public QueryTimeoutException(Throwable cause) { + super( cause ); + } + + + /** + * Constructs a new QueryTimeoutException exception + * with the specified query. + * + * @param query the query. + */ + public QueryTimeoutException(Query query) { + this.query = query; + } + + /** + * Constructs a new QueryTimeoutException exception + * with the specified detail message, cause, and query. + * + * @param message the detail message. + * @param cause the cause. + * @param query the query. + */ + public QueryTimeoutException(String message, Throwable cause, Query query) { + super( message, cause ); + this.query = query; + } + + /** + * Returns the query that caused this exception. + * + * @return the query. + */ + public Query getQuery() { + return this.query; + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/RollbackException.java b/fine-jpa/src/com/fr/third/javax/persistence/RollbackException.java new file mode 100644 index 000000000..207029f50 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/RollbackException.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when + * {@link EntityTransaction#commit() EntityTransaction.commit()} fails. + * + * @see com.fr.third.javax.persistence.EntityTransaction#commit() + * @since Java Persistence 1.0 + */ +public class RollbackException extends PersistenceException { + /** + * Constructs a new RollbackException exception + * with null as its detail message. + */ + public RollbackException() { + super(); + } + + /** + * Constructs a new RollbackException exception + * with the specified detail message. + * + * @param message the detail message. + */ + public RollbackException(String message) { + super( message ); + } + + /** + * Constructs a new RollbackException exception + * with the specified detail message and cause. + * + * @param message the detail message. + * @param cause the cause. + */ + public RollbackException(String message, Throwable cause) { + super( message, cause ); + } + + /** + * Constructs a new RollbackException exception + * with the specified cause. + * + * @param cause the cause. + */ + public RollbackException(Throwable cause) { + super(cause); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTable.java b/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTable.java new file mode 100644 index 000000000..7ab6a2256 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTable.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a secondary table for the annotated entity + * class. Specifying one or more secondary tables indicates that the + * data for the entity class is stored across multiple tables. + * + *

    If no SecondaryTable annotation is specified, + * it is assumed that all persistent fields or properties of the + * entity are mapped to the primary table. If no primary key join + * columns are specified, the join columns are assumed to reference + * the primary key columns of the primary table, and have the same + * names and types as the referenced primary key columns of the + * primary table. + * + *

    + *    Example 1: Single secondary table with a single primary key column.
    + *
    + *    @Entity
    + *    @Table(name="CUSTOMER")
    + *    @SecondaryTable(name="CUST_DETAIL",
    + *        pkJoinColumns=@PrimaryKeyJoinColumn(name="CUST_ID"))
    + *    public class Customer { ... }
    + *
    + *
    + *    Example 2: Single secondary table with multiple primary key columns.
    + *
    + *    @Entity
    + *    @Table(name="CUSTOMER")
    + *    @SecondaryTable(name="CUST_DETAIL",
    + *        pkJoinColumns={
    + *            @PrimaryKeyJoinColumn(name="CUST_ID"),
    + *            @PrimaryKeyJoinColumn(name="CUST_TYPE")})
    + *    public class Customer { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface SecondaryTable { + /** + * (Required) The name of the table. + */ + String name(); + + /** + * (Optional) The catalog of the table. + *

    Defaults to the default catalog. + */ + String catalog() default ""; + + /** + * (Optional) The schema of the table. + *

    Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) The columns that are used to join with + * the primary table. + *

    Defaults to the column(s) of the same name(s) + * as the primary key column(s) in the primary table. + */ + PrimaryKeyJoinColumn[] pkJoinColumns() default { }; + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are typically only used if table generation + * is in effect. These constraints apply in addition to any + * constraints specified by the Column and JoinColumn + * annotations and constraints entailed by primary key mappings. + *

    Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default { }; + + /** + * (Optional) Indexes for the table. These are only used if table generation is in effect. + * + * @return The indexes + */ + Index[] indexes() default {}; + + /** + * (Optional) Used to specify or control the generation of a foreign key constraint for the columns + * corresponding to the pkJoinColumns element when table generation is in effect. + * + * @since Java Persistence 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTables.java b/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTables.java new file mode 100644 index 000000000..d9dc1a30d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SecondaryTables.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies multiple secondary tables for an entity. + * + *

    + *    Example 1: Multiple secondary tables assuming primary key columns are named the same in all tables.
    + *
    + *    @Entity
    + *    @Table(name="EMPLOYEE")
    + *    @SecondaryTables({
    + *        @SecondaryTable(name="EMP_DETAIL"),
    + *        @SecondaryTable(name="EMP_HIST")
    + *    })
    + *    public class Employee { ... }
    + *
    + *
    + *    Example 2: Multiple secondary tables with differently named primary key columns.
    + *
    + *    @Entity
    + *    @Table(name="EMPLOYEE")
    + *    @SecondaryTables({
    + *        @SecondaryTable(name="EMP_DETAIL",
    + *            pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPL_ID")),
    + *        @SecondaryTable(name="EMP_HIST",
    + *            pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPLOYEE_ID"))
    + *    })
    + *    public class Employee { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target(TYPE) +@Retention(RUNTIME) + +public @interface SecondaryTables { + /** + * (Required) The secondary tables for an entity. + */ + SecondaryTable[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SequenceGenerator.java b/fine-jpa/src/com/fr/third/javax/persistence/SequenceGenerator.java new file mode 100644 index 000000000..1a05db87b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SequenceGenerator.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Defines a primary key generator that may be referenced by name when + * a generator element is specified for the {@link GeneratedValue} + * annotation. A sequence generator may be specified on the entity + * class or on the primary key field or property. The scope of the + * generator name is global to the persistence unit (across all + * generator types). + * + *
    + *   Example:
    + *
    + *   @SequenceGenerator(name="EMP_SEQ", allocationSize=25)
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface SequenceGenerator { + /** + * (Required) A unique generator name that can be referenced + * by one or more classes to be the generator for primary key + * values. + */ + String name(); + + /** + * (Optional) The name of the database sequence object from + * which to obtain primary key values. + *

    Defaults to a provider-chosen value. + */ + String sequenceName() default ""; + + /** + * (Optional) The catalog of the sequence generator. + * + * @since Java Persistence 2.0 + */ + String catalog() default ""; + + /** + * (Optional) The schema of the sequence generator. + * + * @since Java Persistence 2.0 + */ + String schema() default ""; + + /** + * (Optional) The value from which the sequence object + * is to start generating. + */ + int initialValue() default 1; + + /** + * (Optional) The amount to increment by when allocating + * sequence numbers from the sequence. + */ + int allocationSize() default 50; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SharedCacheMode.java b/fine-jpa/src/com/fr/third/javax/persistence/SharedCacheMode.java new file mode 100644 index 000000000..058e6ee16 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SharedCacheMode.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Specifies how the provider must use a second-level cache for the + * persistence unit. Corresponds to the value of the persistence.xml + * shared-cache-mode element, and returned as the result of + * {@link com.fr.third.javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()}. + * + * @since Java Persistence 2.0 + */ +public enum SharedCacheMode { + /** + * All entities and entity-related state and data are cached. + */ + ALL, + + /** + * Caching is disabled for the persistence unit. + */ + NONE, + + /** + * Caching is enabled for all entities for Cacheable(true) + * is specified. All other entities are not cached. + */ + ENABLE_SELECTIVE, + + /** + * Caching is enabled for all entities except those for which + * Cacheable(false) is specified. Entities for which + * Cacheable(false) is specified are not cached. + */ + DISABLE_SELECTIVE, + + /** + * + * Caching behavior is undefined: provider-specific defaults may apply. + */ + UNSPECIFIED +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMapping.java b/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMapping.java new file mode 100644 index 000000000..13086b60f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMapping.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the mapping of the result of a native SQL query. + * + *

    + *    Example:
    + *
    + *    Query q = em.createNativeQuery(
    + *        "SELECT o.id AS order_id, " +
    + *            "o.quantity AS order_quantity, " +
    + *            "o.item AS order_item, " +
    + *            "i.name AS item_name, " +
    + *        "FROM Order o, Item i " +
    + *        "WHERE (order_quantity > 25) AND (order_item = i.id)",
    + *    "OrderResults");
    + *
    + *    @SqlResultSetMapping(name="OrderResults",
    + *        entities={
    + *            @EntityResult(entityClass=com.acme.Order.class, fields={
    + *                @FieldResult(name="id", column="order_id"),
    + *                @FieldResult(name="quantity", column="order_quantity"),
    + *                @FieldResult(name="item", column="order_item")})},
    + *        columns={
    + *            @ColumnResult(name="item_name")}
    + *    )
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ TYPE }) +@Retention(RUNTIME) +public @interface SqlResultSetMapping { + /** + * The name given to the result set mapping, and used to refer + * to it in the methods of the {@link Query} API. + */ + String name(); + + /** + * Specifies the result set mapping to entities. + */ + EntityResult[] entities() default { }; + + /** + * Specifies the result set mapping constructor references + */ + ConstructorResult[] classes() default {}; + + /** + * Specifies the result set mapping to scalar values. + */ + ColumnResult[] columns() default { }; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMappings.java b/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMappings.java new file mode 100644 index 000000000..f42cd55d7 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SqlResultSetMappings.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Is used to define one or more {@link SqlResultSetMapping} annotations. + * + * @since Java Persistence 1.0 + */ +@Target({ TYPE }) +@Retention(RUNTIME) +public @interface SqlResultSetMappings { + /** + * One or more SqlResultSetMapping annotations. + */ + SqlResultSetMapping[] value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureParameter.java b/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureParameter.java new file mode 100644 index 000000000..a89ce6063 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureParameter.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies a parameter of a named stored procedure query. All parameters of a named stored procedure query must be specified. + * + * @since Java Persistence 2.1 + * + * @see StoredProcedureQuery + * @see ParameterMode + */ +@Target({}) +@Retention(RUNTIME) +public @interface StoredProcedureParameter { + /** The name of the parameter as defined by the stored procedure in the database. */ + String name() default ""; + + /** Specifies whether the parameter is an IN, INOUT, OUT, or REF_CURSOR parameter. */ + ParameterMode mode() default ParameterMode.IN; + + /** JDBC type of the paramter. */ + Class type(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureQuery.java new file mode 100644 index 000000000..5be3a52e9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/StoredProcedureQuery.java @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.util.Calendar; +import java.util.Date; + +/** + * Interface used to control stored procedure query execution. + * + * @see Query + * @see Parameter + * @since Java Persistence 2.1 + */ +public interface StoredProcedureQuery extends Query { + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use, this hint may or may not be observed. + * + * @param hintName name of the property or hint + * @param value value for the property or hint + * + * @return the same query instance + * + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + StoredProcedureQuery setHint(String hintName, Object value); + + /** + * Bind the value of a Parameter object. + * + * @param param parameter object + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter( + Parameter param, + T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter( + Parameter param, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + StoredProcedureQuery setParameter( + Parameter param, + Date value, + TemporalType temporalType); + + /** + * Bind an argument to a named parameter. + * + * @param name parameter name + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * argument is of incorrect type + */ + StoredProcedureQuery setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * value argument is of incorrect type + */ + StoredProcedureQuery setParameter( + String name, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if the + * value argument is of incorrect type + */ + StoredProcedureQuery setParameter( + String name, + Date value, + TemporalType temporalType); + + /** + * Bind an argument to a positional parameter. + * + * @param position position + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the argument is of incorrect type + */ + StoredProcedureQuery setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + StoredProcedureQuery setParameter( + int position, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query or + * if the value argument is of incorrect type + */ + StoredProcedureQuery setParameter( + int position, + Date value, + TemporalType temporalType); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * + * @param flushMode flush mode + * + * @return the same query instance + */ + StoredProcedureQuery setFlushMode(FlushModeType flushMode); + + /** + * Register a positional parameter. + * All positional parameters must be registered. + * + * @param position parameter position + * @param type type of the parameter + * @param mode parameter mode + * + * @return the same query instance + */ + StoredProcedureQuery registerStoredProcedureParameter( + int position, + Class type, + ParameterMode mode); + + /** + * Register a named parameter. + * When using parameter names, all parameters must be registered + * in the order in which they occur in the parameter list of the + * stored procedure. + * + * @param parameterName name of the parameter as registered or + *

    + * specified in metadata + * @param type type of the parameter + * @param mode parameter mode + * + * @return the same query instance + */ + StoredProcedureQuery registerStoredProcedureParameter( + String parameterName, + Class type, + ParameterMode mode); + + /** + * Retrieve a value passed back from the procedure through an + * INOUT or OUT parameter. + * For portability, all results corresponding to result sets + * and update counts must be retrieved before the values of + * output parameters. + * + * @param position parameter position + * + * @return the result that is passed back through the parameter + * + * @throws IllegalArgumentException if the position does + * not correspond to a parameter of the query or is + * not an INOUT or OUT parameter + */ + Object getOutputParameterValue(int position); + + /** + * Retrieve a value passed back from the procedure through an + * INOUT or OUT parameter. + * For portability, all results corresponding to result sets + * and update counts must be retrieved before the values of + * output parameters. + * + * @param parameterName name of the parameter as registered or + * specified in metadata + * + * @return the result that is passed back through the parameter + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or is + * not an INOUT or OUT parameter + */ + Object getOutputParameterValue(String parameterName); + + /** + * Return true if the first result corresponds to a result set, + * and false if it is an update count or if there are no results + * other than through INOUT and OUT parameters, if any. + * + * @return true if first result corresponds to result set + * + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + boolean execute(); + + /** + * Return true if the next result corresponds to a result set, + * and false if it is an update count or if there are no results + * other than through INOUT and OUT parameters, if any. + * + * @return true if next result corresponds to result set + * + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + boolean hasMoreResults(); + + /** + * Return the update count or -1 if there is no pending result + * or if the next result is not an update count. + * + * @return update count or -1 if there is no pending result or + * if the next result is not an update count + * + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + int getUpdateCount(); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Subgraph.java b/fine-jpa/src/com/fr/third/javax/persistence/Subgraph.java new file mode 100644 index 000000000..04d772ccf --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Subgraph.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import com.fr.third.javax.persistence.metamodel.Attribute; +import java.util.List; + +/** + * This type represents a subgraph for an attribute node that corresponds to a Managed Type. Using this class, + * an entity subgraph can be embedded within an EntityGraph. + * + * @param The type of the attribute. + * + * @since JPA 2.1 + */ +public interface Subgraph { + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attributeName name of the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this managed type. + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public void addAttributeNodes(String ... attributeName); + + /** + * Add one or more attribute nodes to the entity graph. + * + * @param attribute attribute + * + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public void addAttributeNodes(Attribute ... attribute); + + /** + * Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity + * graphs that include related managed types. + * + * @param attribute attribute + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if the EntityGraph has been statically defined + */ + public Subgraph addSubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs + * + * @param attribute attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addSubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity + * graphs that include related managed types. + * + * @param attributeName name of the attribute + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addSubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass + * subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the + * specified attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this managed type. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addSubgraph(String attributeName, Class type); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of + * multinode entity graphs that include related managed types. + * + * @param attribute attribute + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute's target type is not a managed type entity + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related managed types. Subclass subgraphs will + * automatically include the specified attributes of superclass subgraphs + * + * @param attribute attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * @throws IllegalArgumentException if the attribute's target type is not a managed type entity + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(Attribute attribute, Class type); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of + * multi-node entity graphs that include related managed types. + * + * @param attributeName name of the attribute + * + * @return subgraph for the key attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(String attributeName); + + /** + * Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for + * construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include + * the specified attributes of superclass subgraphs + * + * @param attributeName name of the attribute + * @param type entity subclass + * + * @return subgraph for the attribute + * + * @throws IllegalArgumentException if the attribute is not an attribute of this entity. + * @throws IllegalArgumentException if the attribute's target type is not a managed type + * @throws IllegalStateException if this EntityGraph has been statically defined + */ + public Subgraph addKeySubgraph(String attributeName, Class type); + + /** + * Return the attribute nodes corresponding to the attributes of this managed type that are included in the + * subgraph. + * + * @return list of attribute nodes included in the subgraph or empty list if none have been defined + */ + public List> getAttributeNodes(); + + /** + * Return the type of for which this subgraph was defined. + * + * @return managed type referenced by the subgraph + */ + public Class getClassType(); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/SynchronizationType.java b/fine-jpa/src/com/fr/third/javax/persistence/SynchronizationType.java new file mode 100644 index 000000000..707774c5f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/SynchronizationType.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Describes how a persistence context will be synchronized to the database in sync with JTA transactions + * + * @since Java Persistence 2.1 + */ +public enum SynchronizationType { + /** + * Indicates the persistence context is automatically enlisted in (joined to) the current JTA transaction. + */ + SYNCHRONIZED, + /** + * Indicates the persistence context is not enlisted in any JTA transaction unless explicitly joined to that + * transaction by invocation of the EntityManager {@link EntityManager#joinTransaction} method. The persistence + * context remains joined to the transaction until the transaction commits or rolls back. After the transaction + * commits or rolls back, the persistence context will not be joined to any subsequent transaction unless the + * joinTransaction method is invoked in the scope of that subsequent transaction. + * + * Such a persistence context must not be flushed to the database unless it is joined to a transaction. The + * application's use of queries with pessimistic locks, bulk update or delete queries, etc. result in the + * provider throwing {@link TransactionRequiredException}. After the persistence context has been joined to the + * JTA transaction, these operations are again allowed. + */ + UNSYNCHRONIZED +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Table.java b/fine-jpa/src/com/fr/third/javax/persistence/Table.java new file mode 100644 index 000000000..4efaf8aac --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Table.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the primary table for the annotated entity. Additional + * tables may be specified using {@link SecondaryTable} or {@link + * SecondaryTables} annotation. + *

    + * If no Table annotation is specified for an entity + * class, the default values apply. + * + *

    + *    Example:
    + *
    + *    @Entity
    + *    @Table(name="CUST", schema="RECORDS")
    + *    public class Customer { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Table { + /** + * (Optional) The name of the table. + *

    + * Defaults to the entity name. + */ + String name() default ""; + + /** + * (Optional) The catalog of the table. + *

    + * Defaults to the default catalog. + */ + String catalog() default ""; + + /** + * (Optional) The schema of the table. + *

    + * Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) Unique constraints that are to be placed on + * the table. These are only used if table generation is in + * effect. These constraints apply in addition to any constraints + * specified by the Column and JoinColumn + * annotations and constraints entailed by primary key mappings. + *

    + * Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default { }; + + /** + * (Optional) Indexes for the table. These are only used if table generation is in effect. Defaults to no + * additional indexes. + * + * @return The indexes + */ + Index[] indexes() default {}; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/TableGenerator.java b/fine-jpa/src/com/fr/third/javax/persistence/TableGenerator.java new file mode 100644 index 000000000..ac64ab493 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/TableGenerator.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Defines a primary key generator that may be + * referenced by name when a generator element is specified for + * the {@link GeneratedValue} annotation. A table generator + * may be specified on the entity class or on the primary key + * field or property. The scope of the generator name is global + * to the persistence unit (across all generator types). + * + *

    + *    Example 1:
    + *
    + *    @Entity public class Employee {
    + *        ...
    + *        @TableGenerator(
    + *            name="empGen",
    + *            table="ID_GEN",
    + *            pkColumnName="GEN_KEY",
    + *            valueColumnName="GEN_VALUE",
    + *            pkColumnValue="EMP_ID",
    + *            allocationSize=1)
    + *        @Id
    + *        @GeneratedValue(strategy=TABLE, generator="empGen")
    + *        int id;
    + *        ...
    + *    }
    + *
    + *    Example 2:
    + *
    + *    @Entity public class Address {
    + *        ...
    + *        @TableGenerator(
    + *            name="addressGen",
    + *            table="ID_GEN",
    + *            pkColumnName="GEN_KEY",
    + *            valueColumnName="GEN_VALUE",
    + *            pkColumnValue="ADDR_ID")
    + *        @Id
    + *        @GeneratedValue(strategy=TABLE, generator="addressGen")
    + *        int id;
    + *        ...
    + *    }
    + * 
    + * + * @see GeneratedValue + * @since Java Persistence 1.0 + */ +@Target({ TYPE, METHOD, FIELD }) +@Retention(RUNTIME) +public @interface TableGenerator { + /** + * (Required) A unique generator name that can be referenced + * by one or more classes to be the generator for id values. + */ + String name(); + + /** + * (Optional) Name of table that stores the generated id values. + *

    + * Defaults to a name chosen by persistence provider. + */ + String table() default ""; + + /** + * (Optional) The catalog of the table. + *

    + * Defaults to the default catalog. + */ + String catalog() default ""; + + /** + * (Optional) The schema of the table. + *

    + * Defaults to the default schema for user. + */ + String schema() default ""; + + /** + * (Optional) Name of the primary key column in the table. + *

    + * Defaults to a provider-chosen name. + */ + String pkColumnName() default ""; + + /** + * (Optional) Name of the column that stores the last value generated. + *

    + * Defaults to a provider-chosen name. + */ + String valueColumnName() default ""; + + /** + * (Optional) The primary key value in the generator table + * that distinguishes this set of generated values from others + * that may be stored in the table. + *

    + * Defaults to a provider-chosen value to store in the + * primary key column of the generator table + */ + String pkColumnValue() default ""; + + /** + * (Optional) The initial value to be used to initialize the column + * that stores the last value generated. + */ + int initialValue() default 0; + + /** + * (Optional) The amount to increment by when allocating id + * numbers from the generator. + */ + int allocationSize() default 50; + + /** + * (Optional) Unique constraints that are to be placed on the + * table. These are only used if table generation is in effect. + * These constraints apply in addition to primary key constraints. + *

    + * Defaults to no additional constraints. + */ + UniqueConstraint[] uniqueConstraints() default { }; + + /** + * (Optional) Indexes for the table. These are only used if table generation is in effect. + * + * @return The indexes + */ + Index[] indexes() default {}; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Temporal.java b/fine-jpa/src/com/fr/third/javax/persistence/Temporal.java new file mode 100644 index 000000000..b1c29854e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Temporal.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * This annotation must be specified for persistent fields + * or properties of type java.util.Date and + * java.util.Calendar. It may only be specified for fields + * or properties of these types. + *

    + * The Temporal annotation may be used in + * conjunction with the {@link Basic} annotation, the {@link Id} + * annotation, or the {@link ElementCollection} annotation (when + * the element collection value is of such a temporal type. + * + *

    + *     Example:
    + *
    + *     @Temporal(DATE)
    + *     protected java.util.Date endDate;
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Temporal { + /** + * The type used in mapping java.util.Date or java.util.Calendar. + */ + TemporalType value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/TemporalType.java b/fine-jpa/src/com/fr/third/javax/persistence/TemporalType.java new file mode 100644 index 000000000..7aa514306 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/TemporalType.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Type used to indicate a specific mapping of java.util.Date + * or java.util.Calendar. + * + * @since Java Persistence 1.0 + */ +public enum TemporalType { + /** + * Map as java.sql.Date + */ + DATE, + + /** + * Map as java.sql.Time + */ + TIME, + + /** + * Map as java.sql.Timestamp + */ + TIMESTAMP +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/TransactionRequiredException.java b/fine-jpa/src/com/fr/third/javax/persistence/TransactionRequiredException.java new file mode 100644 index 000000000..4a2bd7b9b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/TransactionRequiredException.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * Thrown by the persistence provider when a transaction is required but is not + * active. + * + * @since Java Persistence 1.0 + */ +public class TransactionRequiredException extends PersistenceException { + /** + * Constructs a new TransactionRequiredException exception with + * null as its detail message. + */ + public TransactionRequiredException() { + super(); + } + + /** + * Constructs a new TransactionRequiredException exception with + * the specified detail message. + * + * @param message the detail message. + */ + public TransactionRequiredException(String message) { + super( message ); + } +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Transient.java b/fine-jpa/src/com/fr/third/javax/persistence/Transient.java new file mode 100644 index 000000000..d3b4c975b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Transient.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that the property or field is not persistent. It is used + * to annotate a property or field of an entity class, mapped + * superclass, or embeddable class. + * + *
    + *    Example:
    + *
    + *    @Entity
    + *    public class Employee {
    + *        @Id int id;
    + *        @Transient User currentUser;
    + *        ...
    + *    }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Transient { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Tuple.java b/fine-jpa/src/com/fr/third/javax/persistence/Tuple.java new file mode 100644 index 000000000..07651cb65 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Tuple.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.util.List; + +/** + * Interface for extracting the elements of a query result tuple. + * + * @see TupleElement + * @since Java Persistence 2.0 + */ +public interface Tuple { + /** + * Get the value of the specified tuple element. + * + * @param tupleElement tuple element + * + * @return value of tuple element + * + * @throws IllegalArgumentException if tuple element + * does not correspond to an element in the + * query result tuple + */ + X get(TupleElement tupleElement); + + /** + * Get the value of the tuple element to which the + * specified alias has been assigned. + * + * @param alias alias assigned to tuple element + * @param type of the tuple element + * + * @return value of the tuple element + * + * @throws IllegalArgumentException if alias + * does not correspond to an element in the + * query result tuple or element cannot be + * assigned to the specified type + */ + X get(String alias, Class type); + + /** + * Get the value of the tuple element to which the + * specified alias has been assigned. + * + * @param alias alias assigned to tuple element + * + * @return value of the tuple element + * + * @throws IllegalArgumentException if alias + * does not correspond to an element in the + * query result tuple + */ + Object get(String alias); + + /** + * Get the value of the element at the specified + * position in the result tuple. The first position is 0. + * + * @param i position in result tuple + * @param type type of the tuple element + * + * @return value of the tuple element + * + * @throws IllegalArgumentException if i exceeds + * length of result tuple or element cannot be + * assigned to the specified type + */ + X get(int i, Class type); + + /** + * Get the value of the element at the specified + * position in the result tuple. The first position is 0. + * + * @param i position in result tuple + * + * @return value of the tuple element + * + * @throws IllegalArgumentException if i exceeds + * length of result tuple + */ + Object get(int i); + + /** + * Return the values of the result tuple elements as an array. + * + * @return tuple element values + */ + Object[] toArray(); + + /** + * Return the tuple elements. + * + * @return tuple elements + */ + List> getElements(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/TupleElement.java b/fine-jpa/src/com/fr/third/javax/persistence/TupleElement.java new file mode 100644 index 000000000..11dc727fd --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/TupleElement.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * The TupleElement interface defines an element that is returned in + * a query result tuple. + * + * @param the type of the element + * @see Tuple + * @since Java Persistence 2.0 + */ +public interface TupleElement { + /** + * Return the Java type of the tuple element. + * + * @return the Java type of the tuple element + */ + Class getJavaType(); + + /** + * Return the alias assigned to the tuple element or null, + * if no alias has been assigned. + * + * @return alias + */ + String getAlias(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/TypedQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/TypedQuery.java new file mode 100644 index 000000000..aa4f9139a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/TypedQuery.java @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * Interface used to control the execution of typed queries. + * + * @param query result type + * @see Query + * @see Parameter + * @since Java Persistence 2.0 + */ +public interface TypedQuery extends Query { + /** + * Execute a SELECT query and return the query results + * as a typed List. + * + * @return a list of the results + * + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode has + * been set and there is no transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + List getResultList(); + + /** + * Execute a SELECT query that returns a single result. + * + * @return the result + * + * @throws NoResultException if there is no result + * @throws NonUniqueResultException if more than one result + * @throws IllegalStateException if called for a Java + * Persistence query language UPDATE or DELETE statement + * @throws QueryTimeoutException if the query execution exceeds + * the query timeout value set and only the statement is + * rolled back + * @throws TransactionRequiredException if a lock mode has + * been set and there is no transaction + * @throws PessimisticLockException if pessimistic locking + * fails and the transaction is rolled back + * @throws LockTimeoutException if pessimistic locking + * fails and only the statement is rolled back + * @throws PersistenceException if the query execution exceeds + * the query timeout value set and the transaction + * is rolled back + */ + X getSingleResult(); + + /** + * Set the maximum number of results to retrieve. + * + * @param maxResult maximum number of results to retrieve + * + * @return the same query instance + * + * @throws IllegalArgumentException if the argument is negative + */ + TypedQuery setMaxResults(int maxResult); + + /** + * Set the position of the first result to retrieve. + * + * @param startPosition position of the first result, + * numbered from 0 + * + * @return the same query instance + * + * @throws IllegalArgumentException if the argument is negative + */ + TypedQuery setFirstResult(int startPosition); + + /** + * Set a query property or hint. The hints elements may be used + * to specify query properties and hints. Properties defined by + * this specification must be observed by the provider. + * Vendor-specific hints that are not recognized by a provider + * must be silently ignored. Portable applications should not + * rely on the standard timeout hint. Depending on the database + * in use and the locking mechanisms used by the provider, + * this hint may or may not be observed. + * + * @param hintName name of property or hint + * @param value value for the property or hint + * + * @return the same query instance + * + * @throws IllegalArgumentException if the second argument is not + * valid for the implementation + */ + TypedQuery setHint(String hintName, Object value); + + /** + * Bind the value of a Parameter object. + * + * @param param parameter object + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter + * does not correspond to a parameter of the + * query + */ + TypedQuery setParameter(Parameter param, T value); + + /** + * Bind an instance of java.util.Calendar to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + TypedQuery setParameter(Parameter param, + Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a Parameter object. + * + * @param param parameter object + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter does not + * correspond to a parameter of the query + */ + TypedQuery setParameter(Parameter param, Date value, + TemporalType temporalType); + + /** + * Bind an argument to a named parameter. + * + * @param name parameter name + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the argument is of incorrect type + */ + TypedQuery setParameter(String name, Object value); + + /** + * Bind an instance of java.util.Calendar to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + TypedQuery setParameter(String name, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a named parameter. + * + * @param name parameter name + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if the parameter name does + * not correspond to a parameter of the query or if + * the value argument is of incorrect type + */ + TypedQuery setParameter(String name, Date value, + TemporalType temporalType); + + /** + * Bind an argument to a positional parameter. + * + * @param position position + * @param value parameter value + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the + * query or if the argument is of incorrect type + */ + TypedQuery setParameter(int position, Object value); + + /** + * Bind an instance of java.util.Calendar to a positional + * parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the value argument is of incorrect type + */ + TypedQuery setParameter(int position, Calendar value, + TemporalType temporalType); + + /** + * Bind an instance of java.util.Date to a positional parameter. + * + * @param position position + * @param value parameter value + * @param temporalType temporal type + * + * @return the same query instance + * + * @throws IllegalArgumentException if position does not + * correspond to a positional parameter of the query + * or if the value argument is of incorrect type + */ + TypedQuery setParameter(int position, Date value, + TemporalType temporalType); + + /** + * Set the flush mode type to be used for the query execution. + * The flush mode type applies to the query regardless of the + * flush mode type in use for the entity manager. + * + * @param flushMode flush mode + * + * @return the same query instance + */ + TypedQuery setFlushMode(FlushModeType flushMode); + + /** + * Set the lock mode type to be used for the query execution. + * + * @param lockMode lock mode + * + * @return the same query instance + * + * @throws IllegalStateException if the query is found not to + * be a Java Persistence query language SELECT query + * or a Criteria API query + */ + TypedQuery setLockMode(LockModeType lockMode); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/UniqueConstraint.java b/fine-jpa/src/com/fr/third/javax/persistence/UniqueConstraint.java new file mode 100644 index 000000000..285a26756 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/UniqueConstraint.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies that a unique constraint is to be included in + * the generated DDL for a primary or secondary table. + * + *
    + *    Example:
    + *    @Entity
    + *    @Table(
    + *        name="EMPLOYEE",
    + *        uniqueConstraints=
    + *            @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
    + *    )
    + *    public class Employee { ... }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ }) +@Retention(RUNTIME) +public @interface UniqueConstraint { + /** + * (Optional) Constraint name. A provider-chosen name will be chosen + * if a name is not specified. + * + * @since Java Persistence 2.0 + */ + String name() default ""; + + /** + * (Required) An array of the column names that make up the constraint. + */ + String[] columnNames(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/ValidationMode.java b/fine-jpa/src/com/fr/third/javax/persistence/ValidationMode.java new file mode 100644 index 000000000..bb68badbb --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/ValidationMode.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +/** + * The validation mode to be used by the provider for the persistence + * unit. + * + * @since Java Persistence 2.0 + */ +public enum ValidationMode { + /** + * If a Bean Validation provider is present in the environment, + * the persistence provider must perform the automatic validation + * of entities. If no Bean Validation provider is present in the + * environment, no lifecycle event validation takes place. + * This is the default behavior. + */ + AUTO, + + /** + * The persistence provider must perform the lifecycle event + * validation. It is an error if there is no Bean Validation + * provider present in the environment. + */ + CALLBACK, + + /** + * The persistence provider must not perform lifecycle event validation. + */ + NONE +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/Version.java b/fine-jpa/src/com/fr/third/javax/persistence/Version.java new file mode 100644 index 000000000..eb7a4aeed --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/Version.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Specifies the version field or property of an entity class that + * serves as its optimistic lock value. The version is used to ensure + * integrity when performing the merge operation and for optimistic + * concurrency control. + * + *

    Only a single Version property or field + * should be used per class; applications that use more than one + * Version property or field will not be portable. + * + *

    The Version property should be mapped to + * the primary table for the entity class; applications that + * map the Version property to a table other than + * the primary table will not be portable. + * + *

    The following types are supported for version properties: + * int, Integer, short, + * Short, long, Long, + * java.sql.Timestamp. + * + *

    + *    Example:
    + *
    + *    @Version
    + *    @Column(name="OPTLOCK")
    + *    protected int getVersionNum() { return versionNum; }
    + * 
    + * + * @since Java Persistence 1.0 + */ +@Target({ METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Version { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/AbstractQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/AbstractQuery.java new file mode 100644 index 000000000..f3a79825f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/AbstractQuery.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.EntityType; +import java.util.List; +import java.util.Set; + +/** + * The AbstractQuery interface defines functionality that is common + * to both top-level queries and subqueries. + * It is not intended to be used directly in query construction. + * + *

    All queries must have: + * a set of root entities (which may in turn own joins). + *

    All queries may have: + * a conjunction of restrictions. + * + * @param the type of the result + * + * @since Java Persistence 2.0 + */ +public interface AbstractQuery extends CommonAbstractCriteria { + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * + * @param entityClass the entity class + * + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the given entity, + * forming a cartesian product with any existing roots. + * + * @param entity metamodel entity representing the entity of type X + * + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Modify the query to restrict the query results according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + AbstractQuery where(Expression restriction); + + /** + * Modify the query to restrict the query results according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + AbstractQuery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * + * @param grouping zero or more grouping expressions + * + * @return the modified query + */ + AbstractQuery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * + * @param grouping list of zero or more grouping expressions + * + * @return the modified query + */ + AbstractQuery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the query. + * Replaces the previous having restriction(s), if any. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + AbstractQuery having(Expression restriction); + + /** + * Specify restrictions over the groups of the query + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously added having restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + AbstractQuery having(Predicate... restrictions); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the query result or + * whether they must be retained + * + * @return the modified query + */ + AbstractQuery distinct(boolean distinct); + + /** + * Return the query roots. These are the roots that have + * been defined for the CriteriaQuery or Subquery itself, + * including any subquery roots defined as a result of + * correlation. Returns empty set if no roots have been defined. + * Modifications to the set do not affect the query. + * + * @return the set of query roots + */ + Set> getRoots(); + + /** + * Return the selection of the query, or null if no selection + * has been set. + * + * @return selection item + */ + Selection getSelection(); + + /** + * Return a list of the grouping expressions. Returns empty + * list if no grouping expressions have been specified. + * Modifications to the list do not affect the query. + * + * @return the list of grouping expressions + */ + List> getGroupList(); + + /** + * Return the predicate that corresponds to the restriction(s) + * over the grouping items, or null if no restrictions have + * been specified. + * + * @return having clause predicate + */ + Predicate getGroupRestriction(); + + /** + * Return whether duplicate query results must be eliminated or + * retained. + * + * @return boolean indicating whether duplicate query results + * must be eliminated + */ + boolean isDistinct(); + + /** + * Return the result type of the query or subquery. + * If a result type was specified as an argument to the + * createQuery or subquery method, that type will be returned. + * If the query was created using the createTupleQuery + * method, the result type is Tuple. + * Otherwise, the result type is Object. + * + * @return result type + */ + Class getResultType(); + +} + + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CollectionJoin.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CollectionJoin.java new file mode 100644 index 000000000..c1e060560 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CollectionJoin.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import java.util.Collection; + +/** + * The CollectionJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Collection. + * + * @param the source type of the join + * @param the element type of the target Collection + * @since Java Persistence 2.0 + */ +public interface CollectionJoin + extends PluralJoin, E> { + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restriction a simple or compound boolean expression + * @return the modified join object + */ + CollectionJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restrictions zero or more restriction predicates + * @return the modified join object + */ + CollectionJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the collection + * attribute. + * + * @return metamodel type representing the Collection that is + * the target of the join + */ + CollectionAttribute getModel(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CommonAbstractCriteria.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CommonAbstractCriteria.java new file mode 100644 index 000000000..822fa9849 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CommonAbstractCriteria.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +/** + * The CommonAbstractCriteria interface defines functionality + * that is common to both top-level criteria queries and subqueries as + * well as to update and delete criteria operations. + * It is not intended to be used directly in query construction. + * + *

    Note that criteria queries and criteria update and delete operations + * are typed differently. + * Criteria queries are typed according to the query result type. + * Update and delete operations are typed according to the target of the + * update or delete. + * + * @since Java Persistence 2.1 + */ +public interface CommonAbstractCriteria { + /** + * Create a subquery of the query. + * @param type the subquery result type + * @return subquery + */ + Subquery subquery(Class type); + + /** + * Return the predicate that corresponds to the where clause + * restriction(s), or null if no restrictions have been + * specified. + * @return where clause predicate + */ + Predicate getRestriction(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CompoundSelection.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CompoundSelection.java new file mode 100644 index 000000000..fde821e0c --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CompoundSelection.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +/** + * The CompoundSelection interface defines a compound selection item + * (tuple, array, or result of constructor). + * + * @param the type of the selection item + * + * @since Java Persistence 2.0 + */ +public interface CompoundSelection extends Selection { +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaBuilder.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaBuilder.java new file mode 100644 index 000000000..a47ea500b --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaBuilder.java @@ -0,0 +1,1823 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.Tuple; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +/** + * Used to construct criteria queries, compound selections, + * expressions, predicates, orderings. + * + *

    Note that Predicate is used instead of Expression<Boolean> + * in this API in order to work around the fact that Java + * generics are not compatible with varags. + * + * @since Java Persistence 2.0 + */ +public interface CriteriaBuilder { + + /** + * Create a CriteriaQuery object. + * + * @return criteria query object + */ + CriteriaQuery createQuery(); + + /** + * Create a CriteriaQuery object with the specified result + * type. + * + * @param resultClass type of the query result + * + * @return criteria query object + */ + CriteriaQuery createQuery(Class resultClass); + + /** + * Create a CriteriaQuery object that returns a tuple of + * objects as its result. + * + * @return criteria query object + */ + CriteriaQuery createTupleQuery(); + + + // methods to construct queries for bulk updates and deletes: + + /** + * Create a query object to perform a bulk update operation. + * + * @param targetEntity target type for update operation + * + * @return the query object + */ + CriteriaUpdate createCriteriaUpdate(Class targetEntity); + + /** + * Create a query object to perform a bulk delete operation. + * + * @param targetEntity target type for delete operation + * + * @return the query object + */ + CriteriaDelete createCriteriaDelete(Class targetEntity); + + + // selection construction methods: + + /** + * Create a selection item corresponding to a constructor. + * This method is used to specify a constructor that will be + * applied to the results of the query execution. If the + * constructor is for an entity class, the resulting entities + * will be in the new state after the query is executed. + * + * @param resultClass class whose instance is to be constructed + * @param selections arguments to the constructor + * + * @return compound selection item + * + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection construct(Class resultClass, Selection... selections); + + /** + * Create a tuple-valued selection item. + * + * @param selections selection items + * + * @return tuple-valued compound selection + * + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection tuple(Selection... selections); + + /** + * Create an array-valued selection item. + * + * @param selections selection items + * + * @return array-valued compound selection + * + * @throws IllegalArgumentException if an argument is a + * tuple- or array-valued selection item + */ + CompoundSelection array(Selection... selections); + + + //ordering: + + /** + * Create an ordering by the ascending value of the expression. + * + * @param x expression used to define the ordering + * + * @return ascending ordering corresponding to the expression + */ + Order asc(Expression x); + + /** + * Create an ordering by the descending value of the expression. + * + * @param x expression used to define the ordering + * + * @return descending ordering corresponding to the expression + */ + Order desc(Expression x); + + + //aggregate functions: + + /** + * Create an aggregate expression applying the avg operation. + * + * @param x expression representing input value to avg operation + * + * @return avg expression + */ + Expression avg(Expression x); + + /** + * Create an aggregate expression applying the sum operation. + * + * @param x expression representing input value to sum operation + * + * @return sum expression + */ + Expression sum(Expression x); + + /** + * Create an aggregate expression applying the sum operation to an + * Integer-valued expression, returning a Long result. + * + * @param x expression representing input value to sum operation + * + * @return sum expression + */ + Expression sumAsLong(Expression x); + + /** + * Create an aggregate expression applying the sum operation to a + * Float-valued expression, returning a Double result. + * + * @param x expression representing input value to sum operation + * + * @return sum expression + */ + Expression sumAsDouble(Expression x); + + /** + * Create an aggregate expression applying the numerical max + * operation. + * + * @param x expression representing input value to max operation + * + * @return max expression + */ + Expression max(Expression x); + + /** + * Create an aggregate expression applying the numerical min + * operation. + * + * @param x expression representing input value to min operation + * + * @return min expression + */ + Expression min(Expression x); + + /** + * Create an aggregate expression for finding the greatest of + * the values (strings, dates, etc). + * + * @param x expression representing input value to greatest + * operation + * + * @return greatest expression + */ + > Expression greatest(Expression x); + + /** + * Create an aggregate expression for finding the least of + * the values (strings, dates, etc). + * + * @param x expression representing input value to least + * operation + * + * @return least expression + */ + > Expression least(Expression x); + + /** + * Create an aggregate expression applying the count operation. + * + * @param x expression representing input value to count + * operation + * + * @return count expression + */ + Expression count(Expression x); + + /** + * Create an aggregate expression applying the count distinct + * operation. + * + * @param x expression representing input value to + * count distinct operation + * + * @return count distinct expression + */ + Expression countDistinct(Expression x); + + + //subqueries: + + /** + * Create a predicate testing the existence of a subquery result. + * + * @param subquery subquery whose result is to be tested + * + * @return exists predicate + */ + Predicate exists(Subquery subquery); + + /** + * Create an all expression over the subquery results. + * + * @param subquery subquery + * + * @return all expression + */ + Expression all(Subquery subquery); + + /** + * Create a some expression over the subquery results. + * This expression is equivalent to an any expression. + * + * @param subquery subquery + * + * @return some expression + */ + Expression some(Subquery subquery); + + /** + * Create an any expression over the subquery results. + * This expression is equivalent to a some expression. + * + * @param subquery subquery + * + * @return any expression + */ + Expression any(Subquery subquery); + + + //boolean functions: + + /** + * Create a conjunction of the given boolean expressions. + * + * @param x boolean expression + * @param y boolean expression + * + * @return and predicate + */ + Predicate and(Expression x, Expression y); + + /** + * Create a conjunction of the given restriction predicates. + * A conjunction of zero predicates is true. + * + * @param restrictions zero or more restriction predicates + * + * @return and predicate + */ + Predicate and(Predicate... restrictions); + + /** + * Create a disjunction of the given boolean expressions. + * + * @param x boolean expression + * @param y boolean expression + * + * @return or predicate + */ + Predicate or(Expression x, Expression y); + + /** + * Create a disjunction of the given restriction predicates. + * A disjunction of zero predicates is false. + * + * @param restrictions zero or more restriction predicates + * + * @return or predicate + */ + Predicate or(Predicate... restrictions); + + /** + * Create a negation of the given restriction. + * + * @param restriction restriction expression + * + * @return not predicate + */ + Predicate not(Expression restriction); + + /** + * Create a conjunction (with zero conjuncts). + * A conjunction with zero conjuncts is true. + * + * @return and predicate + */ + Predicate conjunction(); + + /** + * Create a disjunction (with zero disjuncts). + * A disjunction with zero disjuncts is false. + * + * @return or predicate + */ + Predicate disjunction(); + + + //turn Expression into a Predicate + //useful for use with varargs methods + + /** + * Create a predicate testing for a true value. + * + * @param x expression to be tested + * + * @return predicate + */ + Predicate isTrue(Expression x); + + /** + * Create a predicate testing for a false value. + * + * @param x expression to be tested + * + * @return predicate + */ + Predicate isFalse(Expression x); + + + //null tests: + + /** + * Create a predicate to test whether the expression is null. + * + * @param x expression + * + * @return is-null predicate + */ + Predicate isNull(Expression x); + + /** + * Create a predicate to test whether the expression is not null. + * + * @param x expression + * + * @return is-not-null predicate + */ + Predicate isNotNull(Expression x); + + //equality: + + /** + * Create a predicate for testing the arguments for equality. + * + * @param x expression + * @param y expression + * + * @return equality predicate + */ + Predicate equal(Expression x, Expression y); + + /** + * Create a predicate for testing the arguments for equality. + * + * @param x expression + * @param y object + * + * @return equality predicate + */ + Predicate equal(Expression x, Object y); + + /** + * Create a predicate for testing the arguments for inequality. + * + * @param x expression + * @param y expression + * + * @return inequality predicate + */ + Predicate notEqual(Expression x, Expression y); + + /** + * Create a predicate for testing the arguments for inequality. + * + * @param x expression + * @param y object + * + * @return inequality predicate + */ + Predicate notEqual(Expression x, Object y); + + + //comparisons for generic (non-numeric) operands: + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * + * @param x expression + * @param y expression + * + * @return greater-than predicate + */ + > Predicate greaterThan(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * + * @param x expression + * @param y value + * + * @return greater-than predicate + */ + > Predicate greaterThan(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * + * @param x expression + * @param y expression + * + * @return greater-than-or-equal predicate + */ + > Predicate greaterThanOrEqualTo(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * + * @param x expression + * @param y value + * + * @return greater-than-or-equal predicate + */ + > Predicate greaterThanOrEqualTo(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * + * @param x expression + * @param y expression + * + * @return less-than predicate + */ + > Predicate lessThan(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * + * @param x expression + * @param y value + * + * @return less-than predicate + */ + > Predicate lessThan(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * + * @param x expression + * @param y expression + * + * @return less-than-or-equal predicate + */ + > Predicate lessThanOrEqualTo(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * + * @param x expression + * @param y value + * + * @return less-than-or-equal predicate + */ + > Predicate lessThanOrEqualTo(Expression x, Y y); + + /** + * Create a predicate for testing whether the first argument is + * between the second and third arguments in value. + * + * @param v expression + * @param x expression + * @param y expression + * + * @return between predicate + */ + > Predicate between(Expression v, Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * between the second and third arguments in value. + * + * @param v expression + * @param x value + * @param y value + * + * @return between predicate + */ + > Predicate between(Expression v, Y x, Y y); + + + //comparisons for numeric operands: + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * + * @param x expression + * @param y expression + * + * @return greater-than predicate + */ + Predicate gt(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than the second. + * + * @param x expression + * @param y value + * + * @return greater-than predicate + */ + Predicate gt(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * + * @param x expression + * @param y expression + * + * @return greater-than-or-equal predicate + */ + Predicate ge(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * greater than or equal to the second. + * + * @param x expression + * @param y value + * + * @return greater-than-or-equal predicate + */ + Predicate ge(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * + * @param x expression + * @param y expression + * + * @return less-than predicate + */ + Predicate lt(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than the second. + * + * @param x expression + * @param y value + * + * @return less-than predicate + */ + Predicate lt(Expression x, Number y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * + * @param x expression + * @param y expression + * + * @return less-than-or-equal predicate + */ + Predicate le(Expression x, Expression y); + + /** + * Create a predicate for testing whether the first argument is + * less than or equal to the second. + * + * @param x expression + * @param y value + * + * @return less-than-or-equal predicate + */ + Predicate le(Expression x, Number y); + + + //numerical operations: + + /** + * Create an expression that returns the arithmetic negation + * of its argument. + * + * @param x expression + * + * @return arithmetic negation + */ + Expression neg(Expression x); + + /** + * Create an expression that returns the absolute value + * of its argument. + * + * @param x expression + * + * @return absolute value + */ + Expression abs(Expression x); + + /** + * Create an expression that returns the sum + * of its arguments. + * + * @param x expression + * @param y expression + * + * @return sum + */ + Expression sum(Expression x, Expression y); + + /** + * Create an expression that returns the sum + * of its arguments. + * + * @param x expression + * @param y value + * + * @return sum + */ + Expression sum(Expression x, N y); + + /** + * Create an expression that returns the sum + * of its arguments. + * + * @param x value + * @param y expression + * + * @return sum + */ + Expression sum(N x, Expression y); + + /** + * Create an expression that returns the product + * of its arguments. + * + * @param x expression + * @param y expression + * + * @return product + */ + Expression prod(Expression x, Expression y); + + /** + * Create an expression that returns the product + * of its arguments. + * + * @param x expression + * @param y value + * + * @return product + */ + Expression prod(Expression x, N y); + + /** + * Create an expression that returns the product + * of its arguments. + * + * @param x value + * @param y expression + * + * @return product + */ + Expression prod(N x, Expression y); + + /** + * Create an expression that returns the difference + * between its arguments. + * + * @param x expression + * @param y expression + * + * @return difference + */ + Expression diff(Expression x, Expression y); + + /** + * Create an expression that returns the difference + * between its arguments. + * + * @param x expression + * @param y value + * + * @return difference + */ + Expression diff(Expression x, N y); + + /** + * Create an expression that returns the difference + * between its arguments. + * + * @param x value + * @param y expression + * + * @return difference + */ + Expression diff(N x, Expression y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * + * @param x expression + * @param y expression + * + * @return quotient + */ + Expression quot(Expression x, Expression y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * + * @param x expression + * @param y value + * + * @return quotient + */ + Expression quot(Expression x, Number y); + + /** + * Create an expression that returns the quotient + * of its arguments. + * + * @param x value + * @param y expression + * + * @return quotient + */ + Expression quot(Number x, Expression y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * + * @param x expression + * @param y expression + * + * @return modulus + */ + Expression mod(Expression x, Expression y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * + * @param x expression + * @param y value + * + * @return modulus + */ + Expression mod(Expression x, Integer y); + + /** + * Create an expression that returns the modulus + * of its arguments. + * + * @param x value + * @param y expression + * + * @return modulus + */ + Expression mod(Integer x, Expression y); + + /** + * Create an expression that returns the square root + * of its argument. + * + * @param x expression + * + * @return square root + */ + Expression sqrt(Expression x); + + + //typecasts: + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<Long> + */ + Expression toLong(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<Integer> + */ + Expression toInteger(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<Float> + */ + Expression toFloat(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<Double> + */ + Expression toDouble(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<BigDecimal> + */ + Expression toBigDecimal(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param number numeric expression + * + * @return Expression<BigInteger> + */ + Expression toBigInteger(Expression number); + + /** + * Typecast. Returns same expression object. + * + * @param character expression + * + * @return Expression<String> + */ + Expression toString(Expression character); + + + //literals: + + /** + * Create an expression for a literal. + * + * @param value value represented by the expression + * + * @return expression literal + * + * @throws IllegalArgumentException if value is null + */ + Expression literal(T value); + + /** + * Create an expression for a null literal with the given type. + * + * @param resultClass type of the null literal + * + * @return null expression literal + */ + Expression nullLiteral(Class resultClass); + + //parameters: + + /** + * Create a parameter expression. + * + * @param paramClass parameter class + * + * @return parameter expression + */ + ParameterExpression parameter(Class paramClass); + + /** + * Create a parameter expression with the given name. + * + * @param paramClass parameter class + * @param name name that can be used to refer to + * the parameter + * + * @return parameter expression + */ + ParameterExpression parameter(Class paramClass, String name); + + + //collection operations: + + /** + * Create a predicate that tests whether a collection is empty. + * + * @param collection expression + * + * @return is-empty predicate + */ + > Predicate isEmpty(Expression collection); + + /** + * Create a predicate that tests whether a collection is + * not empty. + * + * @param collection expression + * + * @return is-not-empty predicate + */ + > Predicate isNotEmpty(Expression collection); + + /** + * Create an expression that tests the size of a collection. + * + * @param collection expression + * + * @return size expression + */ + > Expression size(Expression collection); + + /** + * Create an expression that tests the size of a collection. + * + * @param collection collection + * + * @return size expression + */ + > Expression size(C collection); + + /** + * Create a predicate that tests whether an element is + * a member of a collection. + * If the collection is empty, the predicate will be false. + * + * @param elem element expression + * @param collection expression + * + * @return is-member predicate + */ + > Predicate isMember(Expression elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * a member of a collection. + * If the collection is empty, the predicate will be false. + * + * @param elem element + * @param collection expression + * + * @return is-member predicate + */ + > Predicate isMember(E elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * not a member of a collection. + * If the collection is empty, the predicate will be true. + * + * @param elem element expression + * @param collection expression + * + * @return is-not-member predicate + */ + > Predicate isNotMember(Expression elem, Expression collection); + + /** + * Create a predicate that tests whether an element is + * not a member of a collection. + * If the collection is empty, the predicate will be true. + * + * @param elem element + * @param collection expression + * + * @return is-not-member predicate + */ + > Predicate isNotMember(E elem, Expression collection); + + + //get the values and keys collections of the Map, which may then + //be passed to size(), isMember(), isEmpty(), etc + + /** + * Create an expression that returns the values of a map. + * + * @param map map + * + * @return collection expression + */ + > Expression> values(M map); + + /** + * Create an expression that returns the keys of a map. + * + * @param map map + * + * @return set expression + */ + > Expression> keys(M map); + + + //string functions: + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string expression + * + * @return like predicate + */ + Predicate like(Expression x, Expression pattern); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string + * + * @return like predicate + */ + Predicate like(Expression x, String pattern); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character expression + * + * @return like predicate + */ + Predicate like(Expression x, Expression pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character + * + * @return like predicate + */ + Predicate like(Expression x, Expression pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string + * @param escapeChar escape character expression + * + * @return like predicate + */ + Predicate like(Expression x, String pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * satisfies the given pattern. + * + * @param x string expression + * @param pattern string + * @param escapeChar escape character + * + * @return like predicate + */ + Predicate like(Expression x, String pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string expression + * + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string + * + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character expression + * + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string expression + * @param escapeChar escape character + * + * @return not-like predicate + */ + Predicate notLike(Expression x, Expression pattern, char escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string + * @param escapeChar escape character expression + * + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern, Expression escapeChar); + + /** + * Create a predicate for testing whether the expression + * does not satisfy the given pattern. + * + * @param x string expression + * @param pattern string + * @param escapeChar escape character + * + * @return not-like predicate + */ + Predicate notLike(Expression x, String pattern, char escapeChar); + + /** + * Create an expression for string concatenation. + * + * @param x string expression + * @param y string expression + * + * @return expression corresponding to concatenation + */ + Expression concat(Expression x, Expression y); + + /** + * Create an expression for string concatenation. + * + * @param x string expression + * @param y string + * + * @return expression corresponding to concatenation + */ + Expression concat(Expression x, String y); + + /** + * Create an expression for string concatenation. + * + * @param x string + * @param y string expression + * + * @return expression corresponding to concatenation + */ + Expression concat(String x, Expression y); + + /** + * Create an expression for substring extraction. + * Extracts a substring starting at the specified position + * through to end of the string. + * First position is 1. + * + * @param x string expression + * @param from start position expression + * + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, Expression from); + + /** + * Create an expression for substring extraction. + * Extracts a substring starting at the specified position + * through to end of the string. + * First position is 1. + * + * @param x string expression + * @param from start position + * + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, int from); + + /** + * Create an expression for substring extraction. + * Extracts a substring of given length starting at the + * specified position. + * First position is 1. + * + * @param x string expression + * @param from start position expression + * @param len length expression + * + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, Expression from, Expression len); + + /** + * Create an expression for substring extraction. + * Extracts a substring of given length starting at the + * specified position. + * First position is 1. + * + * @param x string expression + * @param from start position + * @param len length + * + * @return expression corresponding to substring extraction + */ + Expression substring(Expression x, int from, int len); + + /** + * Used to specify how strings are trimmed. + */ + public static enum Trimspec { + + /** + * Trim from leading end. + */ + LEADING, + + /** + * Trim from trailing end. + */ + TRAILING, + + /** + * Trim from both ends. + */ + BOTH + } + + /** + * Create expression to trim blanks from both ends of + * a string. + * + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(Expression x); + + /** + * Create expression to trim blanks from a string. + * + * @param ts trim specification + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(Trimspec ts, Expression x); + + /** + * Create expression to trim character from both ends of + * a string. + * + * @param t expression for character to be trimmed + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(Expression t, Expression x); + + /** + * Create expression to trim character from a string. + * + * @param ts trim specification + * @param t expression for character to be trimmed + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(Trimspec ts, Expression t, Expression x); + + /** + * Create expression to trim character from both ends of + * a string. + * + * @param t character to be trimmed + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(char t, Expression x); + + /** + * Create expression to trim character from a string. + * + * @param ts trim specification + * @param t character to be trimmed + * @param x expression for string to trim + * + * @return trim expression + */ + Expression trim(Trimspec ts, char t, Expression x); + + /** + * Create expression for converting a string to lowercase. + * + * @param x string expression + * + * @return expression to convert to lowercase + */ + Expression lower(Expression x); + + /** + * Create expression for converting a string to uppercase. + * + * @param x string expression + * + * @return expression to convert to uppercase + */ + Expression upper(Expression x); + + /** + * Create expression to return length of a string. + * + * @param x string expression + * + * @return length expression + */ + Expression length(Expression x); + + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * + * @param x expression for string to be searched + * @param pattern expression for string to be located + * + * @return expression corresponding to position + */ + Expression locate(Expression x, Expression pattern); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * + * @param x expression for string to be searched + * @param pattern string to be located + * + * @return expression corresponding to position + */ + Expression locate(Expression x, String pattern); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * + * @param x expression for string to be searched + * @param pattern expression for string to be located + * @param from expression for position at which to start search + * + * @return expression corresponding to position + */ + Expression locate(Expression x, Expression pattern, Expression from); + + /** + * Create expression to locate the position of one string + * within another, returning position of first character + * if found. + * The first position in a string is denoted by 1. If the + * string to be located is not found, 0 is returned. + * + * @param x expression for string to be searched + * @param pattern string to be located + * @param from position at which to start search + * + * @return expression corresponding to position + */ + Expression locate(Expression x, String pattern, int from); + + + // Date/time/timestamp functions: + + /** + * Create expression to return current date. + * + * @return expression for current date + */ + Expression currentDate(); + + /** + * Create expression to return current timestamp. + * + * @return expression for current timestamp + */ + Expression currentTimestamp(); + + /** + * Create expression to return current time. + * + * @return expression for current time + */ + Expression currentTime(); + + + //in builders: + + /** + * Interface used to build in predicates. + */ + public static interface In extends Predicate { + + /** + * Return the expression to be tested against the + * list of values. + * + * @return expression + */ + Expression getExpression(); + + /** + * Add to list of values to be tested against. + * + * @param value value + * + * @return in predicate + */ + In value(T value); + + /** + * Add to list of values to be tested against. + * + * @param value expression + * + * @return in predicate + */ + In value(Expression value); + } + + /** + * Create predicate to test whether given expression + * is contained in a list of values. + * + * @param expression to be tested against list of values + * + * @return in predicate + */ + In in(Expression expression); + + + // coalesce, nullif: + + /** + * Create an expression that returns null if all its arguments + * evaluate to null, and the value of the first non-null argument + * otherwise. + * + * @param x expression + * @param y expression + * + * @return coalesce expression + */ + Expression coalesce(Expression x, Expression y); + + /** + * Create an expression that returns null if all its arguments + * evaluate to null, and the value of the first non-null argument + * otherwise. + * + * @param x expression + * @param y value + * + * @return coalesce expression + */ + Expression coalesce(Expression x, Y y); + + /** + * Create an expression that tests whether its argument are + * equal, returning null if they are and the value of the + * first expression if they are not. + * + * @param x expression + * @param y expression + * + * @return nullif expression + */ + Expression nullif(Expression x, Expression y); + + /** + * Create an expression that tests whether its argument are + * equal, returning null if they are and the value of the + * first expression if they are not. + * + * @param x expression + * @param y value + * + * @return nullif expression + */ + Expression nullif(Expression x, Y y); + + + // coalesce builder: + + /** + * Interface used to build coalesce expressions. + * + * A coalesce expression is equivalent to a case expression + * that returns null if all its arguments evaluate to null, + * and the value of its first non-null argument otherwise. + */ + public static interface Coalesce extends Expression { + + /** + * Add an argument to the coalesce expression. + * + * @param value value + * + * @return coalesce expression + */ + Coalesce value(T value); + + /** + * Add an argument to the coalesce expression. + * + * @param value expression + * + * @return coalesce expression + */ + Coalesce value(Expression value); + } + + /** + * Create a coalesce expression. + * + * @return coalesce expression + */ + Coalesce coalesce(); + + + //case builders: + + /** + * Interface used to build simple case expressions. + * Case conditions are evaluated in the order in which + * they are specified. + */ + public static interface SimpleCase extends Expression { + + /** + * Return the expression to be tested against the + * conditions. + * + * @return expression + */ + Expression getExpression(); + + /** + * Add a when/then clause to the case expression. + * + * @param condition "when" condition + * @param result "then" result value + * + * @return simple case expression + */ + SimpleCase when(C condition, R result); + + /** + * Add a when/then clause to the case expression. + * + * @param condition "when" condition + * @param result "then" result expression + * + * @return simple case expression + */ + SimpleCase when(C condition, Expression result); + + /** + * Add an "else" clause to the case expression. + * + * @param result "else" result + * + * @return expression + */ + Expression otherwise(R result); + + /** + * Add an "else" clause to the case expression. + * + * @param result "else" result expression + * + * @return expression + */ + Expression otherwise(Expression result); + } + + /** + * Create a simple case expression. + * + * @param expression to be tested against the case conditions + * + * @return simple case expression + */ + SimpleCase selectCase(Expression expression); + + + /** + * Interface used to build general case expressions. + * Case conditions are evaluated in the order in which + * they are specified. + */ + public static interface Case extends Expression { + + /** + * Add a when/then clause to the case expression. + * + * @param condition "when" condition + * @param result "then" result value + * + * @return general case expression + */ + Case when(Expression condition, R result); + + /** + * Add a when/then clause to the case expression. + * + * @param condition "when" condition + * @param result "then" result expression + * + * @return general case expression + */ + Case when(Expression condition, Expression result); + + /** + * Add an "else" clause to the case expression. + * + * @param result "else" result + * + * @return expression + */ + Expression otherwise(R result); + + /** + * Add an "else" clause to the case expression. + * + * @param result "else" result expression + * + * @return expression + */ + Expression otherwise(Expression result); + } + + /** + * Create a general case expression. + * + * @return general case expression + */ + Case selectCase(); + + /** + * Create an expression for the execution of a database + * function. + * + * @param name function name + * @param type expected result type + * @param args function arguments + * + * @return expression + */ + Expression function(String name, Class type, Expression... args); + + /** + * Downcast Join object to the specified type. + * + * @param join Join object + * @param type type to be downcast to + * + * @return Join object of the specified type + */ + Join treat(Join join, Class type); + + /** + * Downcast CollectionJoin object to the specified type. + * + * @param join CollectionJoin object + * @param type type to be downcast to + * + * @return CollectionJoin object of the specified type + */ + CollectionJoin treat(CollectionJoin join, Class type); + + /** + * Downcast SetJoin object to the specified type. + * + * @param join SetJoin object + * @param type type to be downcast to + * + * @return SetJoin object of the specified type + */ + SetJoin treat(SetJoin join, Class type); + + /** + * Downcast ListJoin object to the specified type. + * + * @param join ListJoin object + * @param type type to be downcast to + * + * @return ListJoin object of the specified type + */ + ListJoin treat(ListJoin join, Class type); + + /** + * Downcast MapJoin object to the specified type. + * + * @param join MapJoin object + * @param type type to be downcast to + * + * @return MapJoin object of the specified type + */ + MapJoin treat(MapJoin join, Class type); + + /** + * Downcast Path object to the specified type. + * + * @param path path + * @param type type to be downcast to + * + * @return Path object of the specified type + */ + Path treat(Path path, Class type); + + /** + * Downcast Root object to the specified type. + * + * @param root root + * @param type type to be downcast to + * + * @return Path object of the specified type + */ + Root treat(Root root, Class type); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaDelete.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaDelete.java new file mode 100644 index 000000000..6ad8b2a0e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaDelete.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.EntityType; + +/** + * The CriteriaDelete interface defines functionality for performing + * bulk delete operations using the Criteria API + *

    + * Criteria API bulk delete operations map directly to database + * delete operations. The persistence context is not synchronized + * with the result of the bulk delete. + *

    + * A CriteriaDelete object must have a single root. + * + * @param the entity type that is the target of the delete + * + * @since Java Persistence 2.1 + */ +public interface CriteriaDelete extends CommonAbstractCriteria { + /** + * Create and add a query root corresponding to the entity + * that is the target of the delete. + * A CriteriaDelete object has a single root, the object that + * is being deleted. + * + * @param entityClass the entity class + * + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the entity + * that is the target of the delete. + * A CriteriaDelete object has a single root, the object that + * is being deleted. + * + * @param entity metamodel entity representing the entity + *

    + * of type X + * + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Return the query root. + * + * @return the query root + */ + Root getRoot(); + + /** + * Modify the query to restrict the target of the deletion + * according to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + CriteriaDelete where(Expression restriction); + + /** + * Modify the query to restrict the target of the deletion + * according to the conjunction of the specified restriction + * predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + CriteriaDelete where(Predicate... restrictions); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaQuery.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaQuery.java new file mode 100644 index 000000000..62d1f9e7f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaQuery.java @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import java.util.List; +import java.util.Set; + +/** + * The CriteriaQuery interface defines functionality that is specific + * to top-level queries. + * + * @param the type of the defined result + * @since Java Persistence 2.0 + */ +public interface CriteriaQuery extends AbstractQuery { + + /** + * Specify the item that is to be returned in the query result. + * Replaces the previously specified selection(s), if any. + * + *

    Note: Applications using the string-based API may need to + * specify the type of the select item when it results from + * a get or join operation and the query result type is + * specified. + * + *

    +	 *     For example:
    +	 *
    +	 *     CriteriaQuery<String> q = cb.createQuery(String.class);
    +	 *     Root<Order> order = q.from(Order.class);
    +	 *     q.select(order.get("shippingAddress").<String>get("state"));
    +	 *
    +	 *     CriteriaQuery<Product> q2 = cb.createQuery(Product.class);
    +	 *     q2.select(q2.from(Order.class)
    +	 *                 .join("items")
    +	 *                 .<Item,Product>join("product"));
    +	 *
    +	 * 
    + * + * @param selection selection specifying the item that + * is to be returned in the query result + * + * @return the modified query + * + * @throws IllegalArgumentException if the selection is + * a compound selection and more than one selection + * item has the same assigned alias + */ + CriteriaQuery select(Selection selection); + + /** + * Specify the selection items that are to be returned in the + * query result. + * Replaces the previously specified selection(s), if any. + * + * The type of the result of the query execution depends on + * the specification of the type of the criteria query object + * created as well as the arguments to the multiselect method. + *

    An argument to the multiselect method must not be a tuple- + * or array-valued compound selection item. + * + *

    The semantics of this method are as follows: + *

      + *
    • + * If the type of the criteria query is + * CriteriaQuery<Tuple> (i.e., a criteria + * query object created by either the + * createTupleQuery method or by passing a + * Tuple class argument to the + * createQuery method), a Tuple object + * corresponding to the arguments of the multiselect + * method, in the specified order, will be instantiated and + * returned for each row that results from the query execution. + * + *
    • If the type of the criteria query is CriteriaQuery<X> for + * some user-defined class X (i.e., a criteria query object + * created by passing a X class argument to the createQuery + * method), the arguments to the multiselect method will be + * passed to the X constructor and an instance of type X will be + * returned for each row. + * + *
    • If the type of the criteria query is CriteriaQuery<X[]> for + * some class X, an instance of type X[] will be returned for + * each row. The elements of the array will correspond to the + * arguments of the multiselect method, in the + * specified order. + * + *
    • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and only a single argument is passed to the multiselect + * method, an instance of type Object will be returned for + * each row. + * + *
    • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and more than one argument is passed to the multiselect + * method, an instance of type Object[] will be instantiated + * and returned for each row. The elements of the array will + * correspond to the arguments to the multiselect method, + * in the specified order. + *
    + * + * @param selections selection items corresponding to the + * results to be returned by the query + * + * @return the modified query + * + * @throws IllegalArgumentException if a selection item is + * not valid or if more than one selection item has + * the same assigned alias + */ + CriteriaQuery multiselect(Selection... selections); + + + /** + * Specify the selection items that are to be returned in the + * query result. + * Replaces the previously specified selection(s), if any. + * + *

    The type of the result of the query execution depends on + * the specification of the type of the criteria query object + * created as well as the argument to the multiselect method. + * An element of the list passed to the multiselect method + * must not be a tuple- or array-valued compound selection item. + * + *

    The semantics of this method are as follows: + *

      + *
    • If the type of the criteria query is CriteriaQuery<Tuple> + * (i.e., a criteria query object created by either the + * createTupleQuery method or by passing a Tuple class argument + * to the createQuery method), a Tuple object corresponding to + * the elements of the list passed to the multiselect method, + * in the specified order, will be instantiated and returned for each + * row that results from the query execution. + * + *
    • If the type of the criteria query is CriteriaQuery<X> for + * some user-defined class X (i.e., a criteria query object + * created by passing a X class argument to the createQuery + * method), the elements of the list passed to the multiselect + * method will be passed to the X constructor and an instance + * of type X will be returned for each row. + * + *
    • If the type of the criteria query is CriteriaQuery<X[]> for + * some class X, an instance of type X[] will be returned for + * each row. The elements of the array will correspond to the + * elements of the list passed to the multiselect method, + * in the specified order. + * + *
    • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and the list passed to the multiselect method contains + * only a single element, an instance of type Object will be + * returned for each row. + * + *
    • If the type of the criteria query is CriteriaQuery<Object> + * or if the criteria query was created without specifying a + * type, and the list passed to the multiselect method contains + * more than one element, an instance of type Object[] will be + * instantiated and returned for each row. The elements of the + * array will correspond to the elements of the list passed to + * the multiselect method, in the specified order. + *
    + * + * @param selectionList list of selection items corresponding + * to the results to be returned by the query + * + * @return the modified query + * + * @throws IllegalArgumentException if a selection item is + * not valid or if more than one selection item has + * the same assigned alias + */ + CriteriaQuery multiselect(List> selectionList); + + /** + * Modify the query to restrict the query result according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + CriteriaQuery where(Expression restriction); + + /** + * Modify the query to restrict the query result according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + CriteriaQuery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param grouping zero or more grouping expressions + * + * @return the modified query + */ + CriteriaQuery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the query results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param grouping list of zero or more grouping expressions + * + * @return the modified query + */ + CriteriaQuery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the query. + * Replaces the previous having restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + CriteriaQuery having(Expression restriction); + + /** + * Specify restrictions over the groups of the query + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously added having restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + CriteriaQuery having(Predicate... restrictions); + + /** + * Specify the ordering expressions that are used to + * order the query results. + * Replaces the previous ordering expressions, if any. + * If no ordering expressions are specified, the previous + * ordering, if any, is simply removed, and results will + * be returned in no particular order. + * The left-to-right sequence of the ordering expressions + * determines the precedence, whereby the leftmost has highest + * precedence. + * + * @param o zero or more ordering expressions + * + * @return the modified query + */ + CriteriaQuery orderBy(Order... o); + + /** + * Specify the ordering expressions that are used to + * order the query results. + * Replaces the previous ordering expressions, if any. + * If no ordering expressions are specified, the previous + * ordering, if any, is simply removed, and results will + * be returned in no particular order. + * The order of the ordering expressions in the list + * determines the precedence, whereby the first element in the + * list has highest precedence. + * + * @param o list of zero or more ordering expressions + * + * @return the modified query + */ + CriteriaQuery orderBy(List o); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the query result or + * whether they must be retained + * + * @return the modified query. + */ + CriteriaQuery distinct(boolean distinct); + + /** + * Return the ordering expressions in order of precedence. + * Returns empty list if no ordering expressions have been + * specified. + * Modifications to the list do not affect the query. + * + * @return the list of ordering expressions + */ + List getOrderList(); + + /** + * Return the parameters of the query. Returns empty set if + * there are no parameters. + * Modifications to the set do not affect the query. + * + * @return the query parameters + */ + Set> getParameters(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaUpdate.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaUpdate.java new file mode 100644 index 000000000..5105c352d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/CriteriaUpdate.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.EntityType; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; + +/** + * The CriteriaUpdate interface defines functionality for performing + * bulk update operations using the Criteria API. + *

    + * Criteria API bulk update operations map directly to database update + * operations, bypassing any optimistic locking checks. Portable + * applications using bulk update operations must manually update the + * value of the version column, if desired, and/or manually validate + * the value of the version column. + * The persistence context is not synchronized with the result of the + * bulk update. + *

    + * A CriteriaUpdate object must have a single root. + * + * @param the entity type that is the target of the update + * + * @since Java Persistence 2.1 + */ +public interface CriteriaUpdate extends CommonAbstractCriteria { + /** + * Create and add a query root corresponding to the entity + * that is the target of the update. + * A CriteriaUpdate object has a single root, the object that + * is being updated. + * + * @param entityClass the entity class + * + * @return query root corresponding to the given entity + */ + Root from(Class entityClass); + + /** + * Create and add a query root corresponding to the entity + * that is the target of the update. + * A CriteriaUpdate object has a single root, the object that + * is being updated. + * + * @param entity metamodel entity representing the entity of type X + * + * @return query root corresponding to the given entity + */ + Root from(EntityType entity); + + /** + * Return the query root. + * + * @return the query root + */ + Root getRoot(); + + /** + * Update the value of the specified attribute. + * + * @param attribute attribute to be updated + * @param value new value + * + * @return the modified query + */ + CriteriaUpdate set(SingularAttribute attribute, X value); + + /** + * Update the value of the specified attribute. + * + * @param attribute attribute to be updated + * @param value new value + * + * @return the modified query + */ + CriteriaUpdate set(SingularAttribute attribute, Expression value); + + /** + * Update the value of the specified attribute. + * + * @param attribute attribute to be updated + * @param value new value + * + * @return the modified query + */ + CriteriaUpdate set(Path attribute, X value); + + /** + * Update the value of the specified attribute. + * + * @param attribute attribute to be updated + * @param value new value + * + * @return the modified query + */ + CriteriaUpdate set( + Path attribute, + Expression value); + + /** + * Update the value of the specified attribute. + * + * @param attributeName name of the attribute to be updated + * @param value new value + * + * @return the modified query + */ + CriteriaUpdate set(String attributeName, Object value); + + /** + * Modify the query to restrict the target of the update + * according to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified query + */ + CriteriaUpdate where(Expression restriction); + + /** + * Modify the query to restrict the target of the update + * according to the conjunction of the specified restriction + * predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified query + */ + CriteriaUpdate where(Predicate... restrictions); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Expression.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Expression.java new file mode 100644 index 000000000..323deaee2 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Expression.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import java.util.Collection; + +/** + * Type for query expressions. + * + * @param the type of the expression + * @since Java Persistence 2.0 + */ +public interface Expression extends Selection { + /** + * Create a predicate to test whether the expression is null. + * + * @return predicate testing whether the expression is null + */ + Predicate isNull(); + + /** + * Create a predicate to test whether the expression is + * not null. + * + * @return predicate testing whether the expression is not null + */ + Predicate isNotNull(); + + /** + * Create a predicate to test whether the expression is a member + * of the argument list. + * + * @param values values to be tested against + * + * @return predicate testing for membership + */ + Predicate in(Object... values); + + /** + * Create a predicate to test whether the expression is a member + * of the argument list. + * + * @param values expressions to be tested against + * + * @return predicate testing for membership + */ + Predicate in(Expression... values); + + /** + * Create a predicate to test whether the expression is a member + * of the collection. + * + * @param values collection of values to be tested against + * + * @return predicate testing for membership + */ + Predicate in(Collection values); + + /** + * Create a predicate to test whether the expression is a member + * of the collection. + * + * @param values expression corresponding to collection to be + * tested against + * + * @return predicate testing for membership + */ + Predicate in(Expression> values); + + /** + * Perform a typecast upon the expression, returning a new + * expression object. + * This method does not cause type conversion: + * the runtime type is not changed. + * Warning: may result in a runtime failure. + * + * @param type intended type of the expression + * + * @return new expression of the given type + */ + Expression as(Class type); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Fetch.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Fetch.java new file mode 100644 index 000000000..1082bec12 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Fetch.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.Attribute; + +/** + * Represents a join-fetched association or attribute. + * + * @param the source type of the fetch + * @param the target type of the fetch + * @since Java Persistence 2.0 + */ +public interface Fetch extends FetchParent { + /** + * Return the metamodel attribute corresponding to the + * fetch join. + * + * @return metamodel attribute for the join + */ + Attribute getAttribute(); + + /** + * Return the parent of the fetched item. + * + * @return fetch parent + */ + FetchParent getParent(); + + /** + * Return the join type used in the fetch join. + * + * @return join type + */ + JoinType getJoinType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/FetchParent.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/FetchParent.java new file mode 100644 index 000000000..7e8bc3ed0 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/FetchParent.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; + +/** + * Represents an element of the from clause which may + * function as the parent of Fetches. + * + * @param the source type + * @param the target type + * @since Java Persistence 2.0 + */ +public interface FetchParent { + /** + * Return the fetch joins that have been made from this type. + * Returns empty set if no fetch joins have been made from + * this type. + * Modifications to the set do not affect the query. + * + * @return fetch joins made from this type + */ + java.util.Set> getFetches(); + + /** + * Create a fetch join to the specified single-valued attribute + * using an inner join. + * + * @param attribute target of the join + * + * @return the resulting fetch join + */ + Fetch fetch(SingularAttribute attribute); + + /** + * Create a fetch join to the specified single-valued attribute + * using the given join type. + * + * @param attribute target of the join + * @param jt join type + * + * @return the resulting fetch join + */ + Fetch fetch(SingularAttribute attribute, JoinType jt); + + /** + * Create a fetch join to the specified collection-valued + * attribute using an inner join. + * + * @param attribute target of the join + * + * @return the resulting join + */ + Fetch fetch(PluralAttribute attribute); + + /** + * Create a fetch join to the specified collection-valued + * attribute using the given join type. + * + * @param attribute target of the join + * @param jt join type + * + * @return the resulting join + */ + Fetch fetch(PluralAttribute attribute, JoinType jt); + + + //String-based: + + /** + * Create a fetch join to the specified attribute using an + * inner join. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting fetch join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + @SuppressWarnings("hiding") + Fetch fetch(String attributeName); + + /** + * Create a fetch join to the specified attribute using + * the given join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting fetch join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + @SuppressWarnings("hiding") + Fetch fetch(String attributeName, JoinType jt); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/From.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/From.java new file mode 100644 index 000000000..3d241b10e --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/From.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.CollectionAttribute; +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.SetAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; +import java.util.Set; + +/** + * Represents a bound type, usually an entity that appears in + * the from clause, but may also be an embeddable belonging to + * an entity in the from clause. + *

    Serves as a factory for Joins of associations, embeddables, and + * collections belonging to the type, and for Paths of attributes + * belonging to the type. + * + * @param the source type + * @param the target type + * @since Java Persistence 2.0 + */ +@SuppressWarnings("hiding") +public interface From extends Path, FetchParent { + + /** + * Return the joins that have been made from this bound type. + * Returns empty set if no joins have been made from this + * bound type. + * Modifications to the set do not affect the query. + * + * @return joins made from this type + */ + Set> getJoins(); + + /** + * Whether the From object has been obtained as a result of + * correlation (use of a Subquery correlate + * method). + * + * @return boolean indicating whether the object has been + * obtained through correlation + */ + boolean isCorrelated(); + + /** + * Returns the parent From object from which the correlated + * From object has been obtained through correlation (use + * of a Subquery correlate method). + * + * @return the parent of the correlated From object + * + * @throws IllegalStateException if the From object has + * not been obtained through correlation + */ + From getCorrelationParent(); + + /** + * Create an inner join to the specified single-valued + * attribute. + * + * @param attribute target of the join + * + * @return the resulting join + */ + Join join(SingularAttribute attribute); + + /** + * Create a join to the specified single-valued attribute + * using the given join type. + * + * @param attribute target of the join + * @param jt join type + * + * @return the resulting join + */ + Join join(SingularAttribute attribute, JoinType jt); + + /** + * Create an inner join to the specified Collection-valued + * attribute. + * + * @param collection target of the join + * + * @return the resulting join + */ + CollectionJoin join(CollectionAttribute collection); + + /** + * Create an inner join to the specified Set-valued attribute. + * + * @param set target of the join + * + * @return the resulting join + */ + SetJoin join(SetAttribute set); + + /** + * Create an inner join to the specified List-valued attribute. + * + * @param list target of the join + * + * @return the resulting join + */ + ListJoin join(ListAttribute list); + + /** + * Create an inner join to the specified Map-valued attribute. + * + * @param map target of the join + * + * @return the resulting join + */ + MapJoin join(MapAttribute map); + + /** + * Create a join to the specified Collection-valued attribute + * using the given join type. + * + * @param collection target of the join + * @param jt join type + * + * @return the resulting join + */ + CollectionJoin join(CollectionAttribute collection, JoinType jt); + + /** + * Create a join to the specified Set-valued attribute using + * the given join type. + * + * @param set target of the join + * @param jt join type + * + * @return the resulting join + */ + SetJoin join(SetAttribute set, JoinType jt); + + /** + * Create a join to the specified List-valued attribute using + * the given join type. + * + * @param list target of the join + * @param jt join type + * + * @return the resulting join + */ + ListJoin join(ListAttribute list, JoinType jt); + + /** + * Create a join to the specified Map-valued attribute using + * the given join type. + * + * @param map target of the join + * @param jt join type + * + * @return the resulting join + */ + MapJoin join(MapAttribute map, JoinType jt); + + + //String-based: + + /** + * Create an inner join to the specified attribute. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + Join join(String attributeName); + + /** + * Create an inner join to the specified Collection-valued + * attribute. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + CollectionJoin joinCollection(String attributeName); + + /** + * Create an inner join to the specified Set-valued attribute. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + SetJoin joinSet(String attributeName); + + /** + * Create an inner join to the specified List-valued attribute. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + ListJoin joinList(String attributeName); + + /** + * Create an inner join to the specified Map-valued attribute. + * + * @param attributeName name of the attribute for the + * target of the join + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + MapJoin joinMap(String attributeName); + + /** + * Create a join to the specified attribute using the given + * join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + Join join(String attributeName, JoinType jt); + + /** + * Create a join to the specified Collection-valued attribute + * using the given join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + CollectionJoin joinCollection(String attributeName, JoinType jt); + + /** + * Create a join to the specified Set-valued attribute using + * the given join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + SetJoin joinSet(String attributeName, JoinType jt); + + /** + * Create a join to the specified List-valued attribute using + * the given join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + ListJoin joinList(String attributeName, JoinType jt); + + /** + * Create a join to the specified Map-valued attribute using + * the given join type. + * + * @param attributeName name of the attribute for the + * target of the join + * @param jt join type + * + * @return the resulting join + * + * @throws IllegalArgumentException if attribute of the given + * name does not exist + */ + MapJoin joinMap(String attributeName, JoinType jt); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Join.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Join.java new file mode 100644 index 000000000..3a9df4b76 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Join.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.Attribute; + +/** + * A join to an entity, embeddable, or basic type. + * + * @param the source type of the join + * @param the target type of the join + * @since Java Persistence 2.0 + */ +public interface Join extends From { + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restriction a simple or compound boolean expression + * @return the modified join object + */ + Join on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restrictions zero or more restriction predicates + * @return the modified join object + */ + Join on(Predicate... restrictions); + + /** + * Return the predicate that corresponds to the ON + * restriction(s) on the join, or null if no ON condition + * has been specified. + * @return the ON restriction predicate + */ + Predicate getOn(); + + /** + * Return the metamodel attribute corresponding to the join. + * + * @return metamodel attribute corresponding to the join + */ + Attribute getAttribute(); + + /** + * Return the parent of the join. + * + * @return join parent + */ + From getParent(); + + /** + * Return the join type. + * + * @return join type + */ + JoinType getJoinType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/JoinType.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/JoinType.java new file mode 100644 index 000000000..94a28d228 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/JoinType.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +/** + * Defines the three types of joins. + * + * Right outer joins and right outer fetch joins are not required + * to be supported in Java Persistence 2.0. Applications that use + * RIGHT join types will not be portable. + * + * @since Java Persistence 2.0 + */ +public enum JoinType { + /** + * Inner join. + */ + INNER, + + /** + * Left outer join. + */ + LEFT, + + /** + * Right outer join. + */ + RIGHT +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/ListJoin.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/ListJoin.java new file mode 100644 index 000000000..ae5dd3aa1 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/ListJoin.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.ListAttribute; +import java.util.List; + +/** + * The ListJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.List. + * + * @param the source type of the join + * @param the element type of the target List + * @since Java Persistence 2.0 + */ +public interface ListJoin + extends PluralJoin, E> { + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restriction a simple or compound boolean expression + * @return the modified join object + */ + ListJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restrictions zero or more restriction predicates + * @return the modified join object + */ + ListJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the list attribute. + * + * @return metamodel type representing the List that is + * the target of the join + */ + ListAttribute getModel(); + + /** + * Create an expression that corresponds to the index of + * the object in the referenced association or element + * collection. + * This method must only be invoked upon an object that + * represents an association or element collection for + * which an order column has been defined. + * + * @return expression denoting the index + */ + Expression index(); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/MapJoin.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/MapJoin.java new file mode 100644 index 000000000..9d6238e81 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/MapJoin.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import java.util.Map; + +/** + * The MapJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Map. + * + * @param the source type of the join + * @param the type of the target Map key + * @param the type of the target Map value + * @since Java Persistence 2.0 + */ +public interface MapJoin extends PluralJoin, V> { + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restriction a simple or compound boolean expression + * @return the modified join object + */ + MapJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restrictions zero or more restriction predicates + * @return the modified join object + */ + MapJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the map attribute. + * + * @return metamodel type representing the Map that is + * the target of the join + */ + MapAttribute getModel(); + + /** + * Create a path expression that corresponds to the map key. + * + * @return path corresponding to map key + */ + Path key(); + + /** + * Create a path expression that corresponds to the map value. + * This method is for stylistic use only: it just returns this. + * + * @return path corresponding to the map value + */ + Path value(); + + /** + * Create an expression that corresponds to the map entry. + * + * @return expression corresponding to the map entry + */ + Expression> entry(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Order.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Order.java new file mode 100644 index 000000000..82532a008 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Order.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +/** + * An object that defines an ordering over the query results. + * + * @since Java Persistence 2.0 + */ +public interface Order { + /** + * Switch the ordering. + * + * @return a new Order instance with the reversed ordering + */ + Order reverse(); + + /** + * Whether ascending ordering is in effect. + * + * @return boolean indicating whether ordering is ascending + */ + boolean isAscending(); + + /** + * Return the expression that is used for ordering. + * + * @return expression used for ordering + */ + Expression getExpression(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/ParameterExpression.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/ParameterExpression.java new file mode 100644 index 000000000..c62cd491d --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/ParameterExpression.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.Parameter; + +/** + * Type of criteria query parameter expressions. + * + * @param the type of the parameter expression + * + * @since Java Persistence 2.0 + */ +public interface ParameterExpression extends Parameter, Expression { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Path.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Path.java new file mode 100644 index 000000000..4685e7ab0 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Path.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.Bindable; +import com.fr.third.javax.persistence.metamodel.MapAttribute; +import com.fr.third.javax.persistence.metamodel.PluralAttribute; +import com.fr.third.javax.persistence.metamodel.SingularAttribute; + +/** + * Represents a simple or compound attribute path from a + * bound type or collection, and is a "primitive" expression. + * + * @param the type referenced by the path + * @since Java Persistence 2.0 + */ +public interface Path extends Expression { + /** + * Return the bindable object that corresponds to the + * path expression. + * + * @return bindable object corresponding to the path + */ + Bindable getModel(); + + /** + * Return the parent "node" in the path or null if no parent. + * + * @return parent + */ + Path getParentPath(); + + /** + * Create a path corresponding to the referenced + * single-valued attribute. + * + * @param attribute single-valued attribute + * + * @return path corresponding to the referenced attribute + */ + Path get(SingularAttribute attribute); + + /** + * Create a path corresponding to the referenced + * collection-valued attribute. + * + * @param collection collection-valued attribute + * + * @return expression corresponding to the referenced attribute + */ + > Expression get(PluralAttribute collection); + + /** + * Create a path corresponding to the referenced + * map-valued attribute. + * + * @param map map-valued attribute + * + * @return expression corresponding to the referenced attribute + */ + > Expression get(MapAttribute map); + + /** + * Create an expression corresponding to the type of the path. + * + * @return expression corresponding to the type of the path + */ + Expression> type(); + + + //String-based: + + /** + * Create a path corresponding to the referenced attribute. + * + *

    Note: Applications using the string-based API may need to + * specify the type resulting from the get operation in order + * to avoid the use of Path variables. + * + *

    +	 *     For example:
    +	 *
    +	 *     CriteriaQuery<Person> q = cb.createQuery(Person.class);
    +	 *     Root<Person> p = q.from(Person.class);
    +	 *     q.select(p)
    +	 *      .where(cb.isMember("joe",
    +	 *                         p.<Set<String>>get("nicknames")));
    +	 *
    +	 *     rather than:
    +	 *
    +	 *     CriteriaQuery<Person> q = cb.createQuery(Person.class);
    +	 *     Root<Person> p = q.from(Person.class);
    +	 *     Path<Set<String>> nicknames = p.get("nicknames");
    +	 *     q.select(p)
    +	 *      .where(cb.isMember("joe", nicknames));
    +	 *  
    + * + * @param attributeName name of the attribute + * + * @return path corresponding to the referenced attribute + * + * @throws IllegalStateException if invoked on a path that + * corresponds to a basic type + * @throws IllegalArgumentException if attribute of the given + * name does not otherwise exist + */ + Path get(String attributeName); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/PluralJoin.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/PluralJoin.java new file mode 100644 index 000000000..607285d03 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/PluralJoin.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.PluralAttribute; + +/** + * The PluralJoin interface defines functionality + * that is common to joins to all collection types. It is + * not intended to be used directly in query construction. + * + * @param the source type + * @param the collection type + * @param the element type of the collection + * @since Java Persistence 2.0 + */ +public interface PluralJoin extends Join { + + /** + * Return the metamodel representation for the collection-valued + * attribute corresponding to the join. + * + * @return metamodel collection-valued attribute corresponding + * to the target of the join + */ + PluralAttribute getModel(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Predicate.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Predicate.java new file mode 100644 index 000000000..9ce0293fc --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Predicate.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import java.util.List; + +/** + * The type of a simple or compound predicate: a conjunction or + * disjunction of restrictions. + * A simple predicate is considered to be a conjunction with a + * single conjunct. + * + * @since Java Persistence 2.0 + */ +public interface Predicate extends Expression { + + public static enum BooleanOperator { + AND, + OR + } + + /** + * Return the boolean operator for the predicate. + * If the predicate is simple, this is AND. + * + * @return boolean operator for the predicate + */ + BooleanOperator getOperator(); + + /** + * Whether the predicate has been created from another + * predicate by applying the Predicate.not() method + * or the CriteriaBuilder.not() method. + * + * @return boolean indicating if the predicate is + * a negated predicate + */ + boolean isNegated(); + + /** + * Return the top-level conjuncts or disjuncts of the predicate. + * Returns empty list if there are no top-level conjuncts or + * disjuncts of the predicate. + * Modifications to the list do not affect the query. + * + * @return list of boolean expressions forming the predicate + */ + List> getExpressions(); + + /** + * Create a negation of the predicate. + * + * @return negated predicate + */ + Predicate not(); + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Root.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Root.java new file mode 100644 index 000000000..bf5246491 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Root.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.EntityType; + +/** + * A root type in the from clause. + * Query roots always reference entities. + * + * @param the entity type referenced by the root + * @since Java Persistence 2.0 + */ +public interface Root extends From { + + /** + * Return the metamodel entity corresponding to the root. + * + * @return metamodel entity corresponding to the root + */ + EntityType getModel(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Selection.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Selection.java new file mode 100644 index 000000000..0b17c3ffd --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Selection.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.TupleElement; +import java.util.List; + +/** + * The Selection interface defines an item that is to be + * returned in a query result. + * + * @param the type of the selection item + * @since Java Persistence 2.0 + */ +public interface Selection extends TupleElement { + /** + * Assigns an alias to the selection item. + * Once assigned, an alias cannot be changed or reassigned. + * Returns the same selection item. + * + * @param name alias + * + * @return selection item + */ + Selection alias(String name); + + /** + * Whether the selection item is a compound selection. + * + * @return boolean indicating whether the selection is a compound + * selection + */ + boolean isCompoundSelection(); + + /** + * Return the selection items composing a compound selection. + * Modifications to the list do not affect the query. + * + * @return list of selection items + * + * @throws IllegalStateException if selection is not a + * compound selection + */ + List> getCompoundSelectionItems(); +} + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/SetJoin.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/SetJoin.java new file mode 100644 index 000000000..88deaf38f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/SetJoin.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import com.fr.third.javax.persistence.metamodel.SetAttribute; +import java.util.Set; + +/** + * The SetJoin interface is the type of the result of + * joining to a collection over an association or element + * collection that has been specified as a java.util.Set. + * + * @param the source type of the join + * @param the element type of the target Set + * @since Java Persistence 2.0 + */ +public interface SetJoin extends PluralJoin, E> { + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restriction a simple or compound boolean expression + * @return the modified join object + */ + SetJoin on(Expression restriction); + + /** + * Modify the join to restrict the result according to the + * specified ON condition. Replaces the previous ON condition, + * if any. + * Return the join object + * @param restrictions zero or more restriction predicates + * @return the modified join object + */ + SetJoin on(Predicate... restrictions); + + /** + * Return the metamodel representation for the set attribute. + * + * @return metamodel type representing the Set that is + * the target of the join + */ + SetAttribute getModel(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/criteria/Subquery.java b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Subquery.java new file mode 100644 index 000000000..a7c841376 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/criteria/Subquery.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.criteria; + +import java.util.List; +import java.util.Set; + +/** + * The Subquery interface defines functionality that is + * specific to subqueries. + * + * A subquery has an expression as its selection item. + * + * @param the type of the selection item. + * @since Java Persistence 2.0 + */ +public interface Subquery extends AbstractQuery, Expression { + /** + * Specify the item that is to be returned as the subquery + * result. + * Replaces the previously specified selection, if any. + * + * @param expression expression specifying the item that + * is to be returned as the subquery result + * + * @return the modified subquery + */ + Subquery select(Expression expression); + + /** + * Modify the subquery to restrict the result according + * to the specified boolean expression. + * Replaces the previously added restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified subquery + */ + Subquery where(Expression restriction); + + /** + * Modify the subquery to restrict the result according + * to the conjunction of the specified restriction predicates. + * Replaces the previously added restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified subquery + */ + Subquery where(Predicate... restrictions); + + /** + * Specify the expressions that are used to form groups over + * the subquery results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param grouping zero or more grouping expressions + * + * @return the modified subquery + */ + Subquery groupBy(Expression... grouping); + + /** + * Specify the expressions that are used to form groups over + * the subquery results. + * Replaces the previous specified grouping expressions, if any. + * If no grouping expressions are specified, any previously + * added grouping expressions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param grouping list of zero or more grouping expressions + * + * @return the modified subquery + */ + Subquery groupBy(List> grouping); + + /** + * Specify a restriction over the groups of the subquery. + * Replaces the previous having restriction(s), if any. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restriction a simple or compound boolean expression + * + * @return the modified subquery + */ + Subquery having(Expression restriction); + + /** + * Specify restrictions over the groups of the subquery + * according the conjunction of the specified restriction + * predicates. + * Replaces the previously added having restriction(s), if any. + * If no restrictions are specified, any previously added + * restrictions are simply removed. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param restrictions zero or more restriction predicates + * + * @return the modified subquery + */ + Subquery having(Predicate... restrictions); + + /** + * Specify whether duplicate query results will be eliminated. + * A true value will cause duplicates to be eliminated. + * A false value will cause duplicates to be retained. + * If distinct has not been specified, duplicate results must + * be retained. + * This method only overrides the return type of the + * corresponding AbstractQuery method. + * + * @param distinct boolean value specifying whether duplicate + * results must be eliminated from the subquery result or + * whether they must be retained + * + * @return the modified subquery. + */ + Subquery distinct(boolean distinct); + + /** + * Create a subquery root correlated to a root of the + * enclosing query. + * + * @param parentRoot a root of the containing query + * + * @return subquery root + */ + Root correlate(Root parentRoot); + + /** + * Create a subquery join object correlated to a join object + * of the enclosing query. + * + * @param parentJoin join object of the containing query + * + * @return subquery join + */ + Join correlate(Join parentJoin); + + /** + * Create a subquery collection join object correlated to a + * collection join object of the enclosing query. + * + * @param parentCollection join object of the containing query + * + * @return subquery join + */ + CollectionJoin correlate(CollectionJoin parentCollection); + + /** + * Create a subquery set join object correlated to a set join + * object of the enclosing query. + * + * @param parentSet join object of the containing query + * + * @return subquery join + */ + SetJoin correlate(SetJoin parentSet); + + /** + * Create a subquery list join object correlated to a list join + * object of the enclosing query. + * + * @param parentList join object of the containing query + * + * @return subquery join + */ + ListJoin correlate(ListJoin parentList); + + /** + * Create a subquery map join object correlated to a map join + * object of the enclosing query. + * + * @param parentMap join object of the containing query + * + * @return subquery join + */ + MapJoin correlate(MapJoin parentMap); + + /** + * Return the query (which must be a CriteriaQuery or a Subquery) of which this is a subquery. + * + * @return the enclosing query or subquery + */ + AbstractQuery getParent(); + + /** + * Return the query (which may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, or a Subquery) of which this + * is a subquery. + * + * @return the enclosing query or subquery + * + * @since Java Persistence 2.1 + */ + CommonAbstractCriteria getContainingQuery(); + + /** + * Return the selection expression. + * + * @return the item to be returned in the subquery result + */ + Expression getSelection(); + + /** + * Return the correlated joins of the subquery. + * Returns empty set if the subquery has no correlated + * joins. + * Modifications to the set do not affect the query. + * + * @return the correlated joins of the subquery + */ + Set> getCorrelatedJoins(); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Attribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Attribute.java new file mode 100644 index 000000000..63fee46e7 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Attribute.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Represents an attribute of a Java type. + * + * @param The represented type that contains the attribute + * @param The type of the represented attribute + * @since Java Persistence 2.0 + */ +public interface Attribute { + public static enum PersistentAttributeType { + /** + * Many-to-one association + */ + MANY_TO_ONE, + + /** + * One-to-one association + */ + ONE_TO_ONE, + + /** + * Basic attribute + */ + BASIC, + + /** + * Embeddable class attribute + */ + EMBEDDED, + + /** + * Many-to-many association + */ + MANY_TO_MANY, + + /** + * One-to-many association + */ + ONE_TO_MANY, + + /** + * Element collection + */ + ELEMENT_COLLECTION + } + + /** + * Return the name of the attribute. + * + * @return name + */ + String getName(); + + /** + * Return the persistent attribute type for the attribute. + * + * @return persistent attribute type + */ + PersistentAttributeType getPersistentAttributeType(); + + /** + * Return the managed type representing the type in which + * the attribute was declared. + * + * @return declaring type + */ + ManagedType getDeclaringType(); + + /** + * Return the Java type of the represented attribute. + * + * @return Java type + */ + Class getJavaType(); + + /** + * Return the java.lang.reflect.Member for the represented + * attribute. + * + * @return corresponding java.lang.reflect.Member + */ + java.lang.reflect.Member getJavaMember(); + + /** + * Is the attribute an association. + * + * @return boolean indicating whether the attribute + * corresponds to an association + */ + boolean isAssociation(); + + /** + * Is the attribute collection-valued (represents a Collection, + * Set, List, or Map). + * + * @return boolean indicating whether the attribute is + * collection-valued + */ + boolean isCollection(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/BasicType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/BasicType.java new file mode 100644 index 000000000..6c6ac2f8a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/BasicType.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type BasicType represent basic types (including + * temporal and enumerated types). + * + * @param The type of the represented basic type + * + * @since Java Persistence 2.0 + */ +public interface BasicType extends Type { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Bindable.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Bindable.java new file mode 100644 index 000000000..1e9c959e8 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Bindable.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type Bindable represent object or attribute types + * that can be bound into a {@link com.fr.third.javax.persistence.criteria.Path Path}. + * + * @param The type of the represented object or attribute + * @since Java Persistence 2.0 + */ +public interface Bindable { + public static enum BindableType { + /** + * Single-valued attribute type + */ + SINGULAR_ATTRIBUTE, + + /** + * Multi-valued attribute type + */ + PLURAL_ATTRIBUTE, + + /** + * Entity type + */ + ENTITY_TYPE + } + + /** + * Return the bindable type of the represented object. + * + * @return bindable type + */ + BindableType getBindableType(); + + /** + * Return the Java type of the represented object. + * If the bindable type of the object is PLURAL_ATTRIBUTE, + * the Java element type is returned. If the bindable type is + * SINGULAR_ATTRIBUTE or ENTITY_TYPE, + * the Java type of the + * represented entity or attribute is returned. + * + * @return Java type + */ + Class getBindableJavaType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/CollectionAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/CollectionAttribute.java new file mode 100644 index 000000000..bd52bb0ad --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/CollectionAttribute.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type CollectionAttribute represent persistent + * java.util.Collection-valued attributes. + * + * @param The type the represented Collection belongs to + * @param The element type of the represented Collection + * @since Java Persistence 2.0 + */ +public interface CollectionAttribute extends PluralAttribute, E> { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EmbeddableType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EmbeddableType.java new file mode 100644 index 000000000..940e377ac --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EmbeddableType.java @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type EmbeddableType represent embeddable types. + * + * @param The represented type. + * @since Java Persistence 2.0 + */ +public interface EmbeddableType extends ManagedType { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EntityType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EntityType.java new file mode 100644 index 000000000..cd8ed2243 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/EntityType.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type EntityType represent entity types. + * + * @param The represented entity type. + * @since Java Persistence 2.0 + */ +public interface EntityType extends IdentifiableType, Bindable { + /** + * Return the entity name. + * + * @return entity name + */ + String getName(); +} \ No newline at end of file diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/IdentifiableType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/IdentifiableType.java new file mode 100644 index 000000000..3eeb30110 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/IdentifiableType.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +import java.util.Set; + +/** + * Instances of the type IdentifiableType represent entity or + * mapped superclass types. + * + * @param The represented entity or mapped superclass type. + * @since Java Persistence 2.0 + */ +public interface IdentifiableType extends ManagedType { + /** + * Return the attribute that corresponds to the id attribute of + * the entity or mapped superclass. + * + * @param type the type of the represented id attribute + * + * @return id attribute + * + * @throws IllegalArgumentException if id attribute of the given + * type is not present in the identifiable type or if + * the identifiable type has an id class + */ + SingularAttribute getId(Class type); + + /** + * Return the attribute that corresponds to the id attribute + * declared by the entity or mapped superclass. + * + * @param type the type of the represented declared + * id attribute + * + * @return declared id attribute + * + * @throws IllegalArgumentException if id attribute of the given + * type is not declared in the identifiable type or if + * the identifiable type has an id class + */ + SingularAttribute getDeclaredId(Class type); + + /** + * Return the attribute that corresponds to the version + * attribute of the entity or mapped superclass. + * + * @param type the type of the represented version attribute + * + * @return version attribute + * + * @throws IllegalArgumentException if version attribute of the + * given type is not present in the identifiable type + */ + SingularAttribute getVersion(Class type); + + /** + * Return the attribute that corresponds to the version + * attribute declared by the entity or mapped superclass. + * + * @param type the type of the represented declared version + * attribute + * + * @return declared version attribute + * + * @throws IllegalArgumentException if version attribute of the + * type is not declared in the identifiable type + */ + SingularAttribute getDeclaredVersion(Class type); + + /** + * Return the identifiable type that corresponds to the most + * specific mapped superclass or entity extended by the entity + * or mapped superclass. + * + * @return supertype of identifiable type or null if no + * such supertype + */ + IdentifiableType getSupertype(); + + /** + * Whether the identifiable type has a single id attribute. + * Returns true for a simple id or embedded id; returns false + * for an idclass. + * + * @return boolean indicating whether the identifiable + * type has a single id attribute + */ + boolean hasSingleIdAttribute(); + + /** + * Whether the identifiable type has a version attribute. + * + * @return boolean indicating whether the identifiable + * type has a version attribute + */ + boolean hasVersionAttribute(); + + /** + * Return the attributes corresponding to the id class of the + * identifiable type. + * + * @return id attributes + * + * @throws IllegalArgumentException if the identifiable type + * does not have an id class + */ + Set> getIdClassAttributes(); + + /** + * Return the type that represents the type of the id. + * + * @return type of id + */ + Type getIdType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ListAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ListAttribute.java new file mode 100644 index 000000000..008069c70 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ListAttribute.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type ListAttribute represent persistent + * javax.util.List-valued attributes. + * + * @param The type the represented List belongs to + * @param The element type of the represented List + * @since Java Persistence 2.0 + */ +public interface ListAttribute + extends PluralAttribute, E> { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ManagedType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ManagedType.java new file mode 100644 index 000000000..8b1629ecd --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/ManagedType.java @@ -0,0 +1,398 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +import java.util.Set; + +/** + * Instances of the type ManagedType represent entity, mapped + * superclass, and embeddable types. + * + * @param The represented type. + * @since Java Persistence 2.0 + */ +public interface ManagedType extends Type { + /** + * Return the attributes of the managed type. + * + * @return attributes of the managed type + */ + Set> getAttributes(); + + /** + * Return the attributes declared by the managed type. + * Returns empty set if the managed type has no declared + * attributes. + * + * @return declared attributes of the managed type + */ + Set> getDeclaredAttributes(); + + /** + * Return the single-valued attribute of the managed + * type that corresponds to the specified name and Java type. + * + * @param name the name of the represented attribute + * @param type the type of the represented attribute + * + * @return single-valued attribute with given name and type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + SingularAttribute getSingularAttribute(String name, Class type); + + /** + * Return the single-valued attribute declared by the + * managed type that corresponds to the specified name and + * Java type. + * + * @param name the name of the represented attribute + * @param type the type of the represented attribute + * + * @return declared single-valued attribute of the given + * name and type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + SingularAttribute getDeclaredSingularAttribute(String name, Class type); + + /** + * Return the single-valued attributes of the managed type. + * Returns empty set if the managed type has no single-valued + * attributes. + * + * @return single-valued attributes + */ + Set> getSingularAttributes(); + + /** + * Return the single-valued attributes declared by the managed + * type. + * Returns empty set if the managed type has no declared + * single-valued attributes. + * + * @return declared single-valued attributes + */ + Set> getDeclaredSingularAttributes(); + + /** + * Return the Collection-valued attribute of the managed type + * that corresponds to the specified name and Java element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return CollectionAttribute of the given name and element + * type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + CollectionAttribute getCollection(String name, Class elementType); + + /** + * Return the Collection-valued attribute declared by the + * managed type that corresponds to the specified name and Java + * element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return declared CollectionAttribute of the given name and + * element type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + CollectionAttribute getDeclaredCollection(String name, Class elementType); + + /** + * Return the Set-valued attribute of the managed type that + * corresponds to the specified name and Java element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return SetAttribute of the given name and element type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + SetAttribute getSet(String name, Class elementType); + + /** + * Return the Set-valued attribute declared by the managed type + * that corresponds to the specified name and Java element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return declared SetAttribute of the given name and + * element type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + SetAttribute getDeclaredSet(String name, Class elementType); + + /** + * Return the List-valued attribute of the managed type that + * corresponds to the specified name and Java element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return ListAttribute of the given name and element type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + ListAttribute getList(String name, Class elementType); + + /** + * Return the List-valued attribute declared by the managed + * type that corresponds to the specified name and Java + * element type. + * + * @param name the name of the represented attribute + * @param elementType the element type of the represented + * attribute + * + * @return declared ListAttribute of the given name and + * element type + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + ListAttribute getDeclaredList(String name, Class elementType); + + /** + * Return the Map-valued attribute of the managed type that + * corresponds to the specified name and Java key and value + * types. + * + * @param name the name of the represented attribute + * @param keyType the key type of the represented attribute + * @param valueType the value type of the represented attribute + * + * @return MapAttribute of the given name and key and value + * types + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not present in the managed type + */ + MapAttribute getMap(String name, Class keyType, Class valueType); + + /** + * Return the Map-valued attribute declared by the managed + * type that corresponds to the specified name and Java key + * and value types. + * + * @param name the name of the represented attribute + * @param keyType the key type of the represented attribute + * @param valueType the value type of the represented attribute + * + * @return declared MapAttribute of the given name and key + * and value types + * + * @throws IllegalArgumentException if attribute of the given + * name and type is not declared in the managed type + */ + MapAttribute getDeclaredMap(String name, Class keyType, Class valueType); + + /** + * Return all multi-valued attributes (Collection-, Set-, + * List-, and Map-valued attributes) of the managed type. + * Returns empty set if the managed type has no multi-valued + * attributes. + * + * @return Collection-, Set-, List-, and Map-valued attributes + */ + Set> getPluralAttributes(); + + /** + * Return all multi-valued attributes (Collection-, Set-, + * List-, and Map-valued attributes) declared by the + * managed type. + * Returns empty set if the managed type has no declared + * multi-valued attributes. + * + * @return declared Collection-, Set-, List-, and Map-valued + * attributes + */ + Set> getDeclaredPluralAttributes(); + + +//String-based: + + /** + * Return the attribute of the managed + * type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return attribute with given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + Attribute getAttribute(String name); + + /** + * Return the attribute declared by the managed + * type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return attribute with given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + Attribute getDeclaredAttribute(String name); + + /** + * Return the single-valued attribute of the managed type that + * corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return single-valued attribute with the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + SingularAttribute getSingularAttribute(String name); + + /** + * Return the single-valued attribute declared by the managed + * type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return declared single-valued attribute of the given + * name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + SingularAttribute getDeclaredSingularAttribute(String name); + + /** + * Return the Collection-valued attribute of the managed type + * that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return CollectionAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + CollectionAttribute getCollection(String name); + + /** + * Return the Collection-valued attribute declared by the + * managed type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return declared CollectionAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + CollectionAttribute getDeclaredCollection(String name); + + /** + * Return the Set-valued attribute of the managed type that + * corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return SetAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + SetAttribute getSet(String name); + + /** + * Return the Set-valued attribute declared by the managed type + * that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return declared SetAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + SetAttribute getDeclaredSet(String name); + + /** + * Return the List-valued attribute of the managed type that + * corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return ListAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + ListAttribute getList(String name); + + /** + * Return the List-valued attribute declared by the managed + * type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return declared ListAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + ListAttribute getDeclaredList(String name); + + /** + * Return the Map-valued attribute of the managed type that + * corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return MapAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not present in the managed type + */ + MapAttribute getMap(String name); + + /** + * Return the Map-valued attribute declared by the managed + * type that corresponds to the specified name. + * + * @param name the name of the represented attribute + * + * @return declared MapAttribute of the given name + * + * @throws IllegalArgumentException if attribute of the given + * name is not declared in the managed type + */ + MapAttribute getDeclaredMap(String name); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MapAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MapAttribute.java new file mode 100644 index 000000000..ef45fc904 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MapAttribute.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type MapAttribute represent + * persistent java.util.Map-valued attributes. + * + * @param The type the represented Map belongs to + * @param The type of the key of the represented Map + * @param The type of the value of the represented Map + * @since Java Persistence 2.0 + */ +public interface MapAttribute extends PluralAttribute, V> { + /** + * Return the Java type of the map key. + * + * @return Java key type + */ + Class getKeyJavaType(); + + /** + * Return the type representing the key type of the map. + * + * @return type representing key type + */ + Type getKeyType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MappedSuperclassType.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MappedSuperclassType.java new file mode 100644 index 000000000..f83f8b653 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/MappedSuperclassType.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type MappedSuperclassType represent mapped + * superclass types. + * + * @param The represented entity type + * @since Java Persistence 2.0 + */ +public interface MappedSuperclassType extends IdentifiableType { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Metamodel.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Metamodel.java new file mode 100644 index 000000000..bffecdcac --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Metamodel.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +import java.util.Set; + +/** + * Provides access to the metamodel of persistent + * entities in the persistence unit. + * + * @since Java Persistence 2.0 + */ +public interface Metamodel { + /** + * Return the metamodel entity type representing the entity. + * + * @param cls the type of the represented entity + * + * @return the metamodel entity type + * + * @throws IllegalArgumentException if not an entity + */ + EntityType entity(Class cls); + + /** + * Return the metamodel managed type representing the + * entity, mapped superclass, or embeddable class. + * + * @param cls the type of the represented managed class + * + * @return the metamodel managed type + * + * @throws IllegalArgumentException if not a managed class + */ + ManagedType managedType(Class cls); + + /** + * Return the metamodel embeddable type representing the + * embeddable class. + * + * @param cls the type of the represented embeddable class + * + * @return the metamodel embeddable type + * + * @throws IllegalArgumentException if not an embeddable class + */ + EmbeddableType embeddable(Class cls); + + /** + * Return the metamodel managed types. + * + * @return the metamodel managed types + */ + Set> getManagedTypes(); + + /** + * Return the metamodel entity types. + * + * @return the metamodel entity types + */ + Set> getEntities(); + + /** + * Return the metamodel embeddable types. Returns empty set + * if there are no embeddable types. + * + * @return the metamodel embeddable types + */ + Set> getEmbeddables(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/PluralAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/PluralAttribute.java new file mode 100644 index 000000000..66b8f8678 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/PluralAttribute.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type PluralAttribute represent + * persistent collection-valued attributes. + * + * @param The type the represented collection belongs to + * @param The type of the represented collection + * @param The element type of the represented collection + * @since Java Persistence 2.0 + */ +public interface PluralAttribute extends Attribute, Bindable { + public static enum CollectionType { + /** + * Collection-valued attribute + */ + COLLECTION, + + /** + * Set-valued attribute + */ + SET, + + /** + * List-valued attribute + */ + LIST, + + /** + * Map-valued attribute + */ + MAP + } + + /** + * Return the collection type. + * + * @return collection type + */ + CollectionType getCollectionType(); + + /** + * Return the type representing the element type of the + * collection. + * + * @return element type + */ + Type getElementType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SetAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SetAttribute.java new file mode 100644 index 000000000..9f8ff65e9 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SetAttribute.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type SetAttribute represent + * persistent java.util.Set-valued attributes. + * + * @param The type the represented Set belongs to + * @param The element type of the represented Set + * + * @since Java Persistence 2.0 + */ +public interface SetAttribute extends PluralAttribute, E> { +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SingularAttribute.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SingularAttribute.java new file mode 100644 index 000000000..a20077c25 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/SingularAttribute.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type SingularAttribute represents persistent + * single-valued properties or fields. + * + * @param The type containing the represented attribute + * @param The type of the represented attribute + * @since Java Persistence 2.0 + */ +public interface SingularAttribute extends Attribute, Bindable { + /** + * Is the attribute an id attribute. This method will return + * true if the attribute is an attribute that corresponds to + * a simple id, an embedded id, or an attribute of an id class. + * + * @return boolean indicating whether the attribute is an id + */ + boolean isId(); + + /** + * Is the attribute a version attribute. + * + * @return boolean indicating whether the attribute is + * a version attribute + */ + boolean isVersion(); + + /** + * Can the attribute be null. + * + * @return boolean indicating whether the attribute can + * be null + */ + boolean isOptional(); + + /** + * Return the type that represents the type of the attribute. + * + * @return type of attribute + */ + Type getType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/StaticMetamodel.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/StaticMetamodel.java new file mode 100644 index 000000000..7c963cc9a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/StaticMetamodel.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * The StaticMetamodel annotation specifies that the class + * is a metamodel class that represents the entity, mapped + * superclass, or embeddable class designated by the value + * element. + * + * @since Java Persistence 2.0 + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface StaticMetamodel { + /** + * Class being modeled by the annotated class. + */ + Class value(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Type.java b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Type.java new file mode 100644 index 000000000..e98286c55 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/metamodel/Type.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.metamodel; + +/** + * Instances of the type Type represent persistent object + * or attribute types. + * + * @param The type of the represented object or attribute + * @since Java Persistence 2.0 + */ +public interface Type { + public static enum PersistenceType { + /** + * Entity + */ + ENTITY, + + /** + * Embeddable class + */ + EMBEDDABLE, + + /** + * Mapped superclass + */ + MAPPED_SUPERCLASS, + + /** + * Basic type + */ + BASIC + } + + /** + * Return the persistence type. + * + * @return persistence type + */ + PersistenceType getPersistenceType(); + + /** + * Return the represented Java type. + * + * @return Java type + */ + Class getJavaType(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/package-info.java b/fine-jpa/src/com/fr/third/javax/persistence/package-info.java new file mode 100644 index 000000000..cbf0d9b09 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence; + diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/ClassTransformer.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/ClassTransformer.java new file mode 100644 index 000000000..d4e6d2069 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/ClassTransformer.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +import java.lang.instrument.IllegalClassFormatException; +import java.security.ProtectionDomain; + +/** + * A persistence provider supplies an instance of this + * interface to the {@link PersistenceUnitInfo#addTransformer + * PersistenceUnitInfo.addTransformer} + * method. The supplied transformer instance will get + * called to transform entity class files when they are + * loaded or redefined. The transformation occurs before + * the class is defined by the JVM. + * + * @since Java Persistence 1.0 + */ +public interface ClassTransformer { + + /** + * Invoked when a class is being loaded or redefined. + * The implementation of this method may transform the + * supplied class file and return a new replacement class + * file. + * + * @param loader the defining loader of the class to be + * transformed, may be null if the bootstrap loader + * @param className the name of the class in the internal form + * of fully qualified class and interface names + * @param classBeingRedefined if this is a redefine, the + * class being redefined, otherwise null + * @param protectionDomain the protection domain of the + * class being defined or redefined + * @param classfileBuffer the input byte buffer in class + * file format - must not be modified + * + * @return a well-formed class file buffer (the result of + * the transform), or null if no transform is performed + * + * @throws IllegalClassFormatException if the input does + * not represent a well-formed class file + */ + byte[] transform( + ClassLoader loader, + String className, + Class classBeingRedefined, + ProtectionDomain protectionDomain, + byte[] classfileBuffer) throws IllegalClassFormatException; +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/LoadState.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/LoadState.java new file mode 100644 index 000000000..a7bca27b5 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/LoadState.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +/** + * Load states returned by the {@link ProviderUtil} SPI methods. + * + * @since Java Persistence 2.0 + */ +public enum LoadState { + /** + * The state of the element is known to have been loaded. + */ + LOADED, + /** + * The state of the element is known not to have been loaded. + */ + NOT_LOADED, + /** + * The load state of the element cannot be determined. + */ + UNKNOWN +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProvider.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProvider.java new file mode 100644 index 000000000..82b5fc6a8 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProvider.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +import com.fr.third.javax.persistence.EntityManagerFactory; +import java.util.Map; + +/** + * Interface implemented by the persistence provider. + * + *

    It is invoked by the container in Java EE environments and + * by the {@link com.fr.third.javax.persistence.Persistence} class in Java SE environments to + * create an {@link com.fr.third.javax.persistence.EntityManagerFactory}. + * + * @since Java Persistence 1.0 + */ +public interface PersistenceProvider { + /** + * Called by Persistence class when an + * EntityManagerFactory is to be created. + * + * @param emName the name of the persistence unit + * @param map a Map of properties for use by the + * persistence provider. These properties may be used to + * override the values of the corresponding elements in + * the persistence.xml file or specify values for + * properties not specified in the persistence.xml + * (and may be null if no properties are specified). + * + * @return EntityManagerFactory for the persistence unit, + * or null if the provider is not the right provider + */ + public EntityManagerFactory createEntityManagerFactory(String emName, Map map); + + /** + * Called by the container when an EntityManagerFactory + * is to be created. + * + * @param info metadata for use by the persistence provider + * @param map a Map of integration-level properties for use + * by the persistence provider (may be null if no properties + * are specified). + * If a Bean Validation provider is present in the classpath, + * the container must pass the ValidatorFactory instance in + * the map with the key "com.fr.third.javax.persistence.validation.factory". + * + * @return EntityManagerFactory for the persistence unit + * specified by the metadata + */ + public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map); + + /** + * Create database schemas and/or tables and/or create DDL + * scripts as determined by the supplied properties. + * + * Called by the container when schema generation is to + * occur as a separate phase from creation of the entity + * manager factory. + * + * @param info metadata for use by the persistence provider + * @param map properties for schema generation; these may also include provider-specific properties + * + * @throws com.fr.third.javax.persistence.PersistenceException if insufficient or inconsistent configuration information is + * provided or if schema generation otherwise fails. + */ + public void generateSchema(PersistenceUnitInfo info, Map map); + + /** + * Create database schemas and/or tables and/or create DDL + * scripts as determined by the supplied properties. + * Called by the Persistence class when schema generation is to + * occur as a separate phase from creation of the entity + * manager factory. + * + * @param persistenceUnitName the name of the persistence unit + * @param map properties for schema generation; these may also contain provider-specific properties. The value of + * these properties override any values that may have been configured elsewhere. + * + * @return true if schema was generated, otherwise false + * + * @throws com.fr.third.javax.persistence.PersistenceException if insufficient or inconsistent configuration information is + * provided or if schema generation otherwise fails. + */ + public boolean generateSchema(String persistenceUnitName, Map map); + + /** + * Return the utility interface implemented by the persistence + * provider. + * + * @return ProviderUtil interface + * + * @since Java Persistence 2.0 + */ + public ProviderUtil getProviderUtil(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolver.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolver.java new file mode 100644 index 000000000..6cb17e48a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolver.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +import java.util.List; + +/** + * Determine the list of persistence providers available in the + * runtime environment. + * + *

    Implementations must be thread-safe. + * + *

    Note that the getPersistenceProviders method can potentially + * be called many times: it is recommended that the implementation + * of this method make use of caching. + * + * @see PersistenceProvider + * @since Java Persistence 2.0 + */ +public interface PersistenceProviderResolver { + /** + * Returns a list of the PersistenceProvider implementations + * available in the runtime environment. + * + * @return list of the persistence providers available + * in the environment + */ + List getPersistenceProviders(); + + /** + * Clear cache of providers. + */ + void clearCachedProviders(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolverHolder.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolverHolder.java new file mode 100644 index 000000000..ad569abe6 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceProviderResolverHolder.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +import com.fr.third.javax.persistence.PersistenceException; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.ref.WeakReference; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.WeakHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Holds the global PersistenceProviderResolver instance. + * If no PersistenceProviderResolver is set by the environment, + * the default PersistenceProviderResolver is used. + * + * Implementations must be thread-safe. + */ +public class PersistenceProviderResolverHolder { + private static final PersistenceProviderResolver DEFAULT_RESOLVER = new PersistenceProviderResolverPerClassLoader(); + + private static volatile PersistenceProviderResolver RESOLVER; + + /** + * Returns the current persistence provider resolver + * + * @return persistence provider resolver in use + */ + public static PersistenceProviderResolver getPersistenceProviderResolver() { + return RESOLVER == null ? DEFAULT_RESOLVER : RESOLVER; + } + + /** + * Defines the persistence provider resolver used. + * + * @param resolver PersistenceProviderResolver to be used. + */ + public static void setPersistenceProviderResolver(PersistenceProviderResolver resolver) { + RESOLVER = resolver; + } + + /** + * Cache PersistenceProviderResolver per classloader and use the current classloader as a + * key. + * Use CachingPersistenceProviderResolver for each PersistenceProviderResolver instance. + * + * @author Emmanuel Bernard + */ + private static class PersistenceProviderResolverPerClassLoader implements PersistenceProviderResolver { + + //FIXME use a ConcurrentHashMap with weak entry + private final WeakHashMap resolvers = + new WeakHashMap(); + private volatile short barrier = 1; + + /** + * {@inheritDoc} + */ + public List getPersistenceProviders() { + ClassLoader cl = getContextualClassLoader(); + if ( barrier == 1 ) {} //read barrier syncs state with other threads + PersistenceProviderResolver currentResolver = resolvers.get( cl ); + if ( currentResolver == null ) { + currentResolver = new CachingPersistenceProviderResolver( cl ); + resolvers.put( cl, currentResolver ); + barrier = 1; + } + return currentResolver.getPersistenceProviders(); + } + + /** + * {@inheritDoc} + */ + public void clearCachedProviders() { + // todo : should we clear all providers from all resolvers here? + ClassLoader cl = getContextualClassLoader(); + if ( barrier == 1 ) {} //read barrier syncs state with other threads + PersistenceProviderResolver currentResolver = resolvers.get( cl ); + if ( currentResolver != null ) { + currentResolver.clearCachedProviders(); + } + } + + private static ClassLoader getContextualClassLoader() { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if ( cl == null ) { + cl = PersistenceProviderResolverPerClassLoader.class.getClassLoader(); + } + return cl; + } + + /** + * Resolve the list of Persistence providers for a given classloader and cache the results. + * + * Avoids to keep any reference from this class to the classloader being + * passed to the constructor. + * + * @author Emmanuel Bernard + */ + private static class CachingPersistenceProviderResolver implements PersistenceProviderResolver { + //this assumes that the class loader keeps the list of classes loaded + private final List>> resolverClasses + = new ArrayList>>(); + + public CachingPersistenceProviderResolver(ClassLoader cl) { + loadResolverClasses( cl ); + } + + private void loadResolverClasses(ClassLoader cl) { + synchronized ( resolverClasses ) { + try { + Enumeration resources = cl.getResources( "META-INF/services/" + PersistenceProvider.class.getName() ); + Set names = new HashSet(); + while ( resources.hasMoreElements() ) { + URL url = resources.nextElement(); + InputStream is = url.openStream(); + try { + names.addAll( providerNamesFromReader( new BufferedReader( new InputStreamReader( is ) ) ) ); + } + finally { + is.close(); + } + } + for ( String s : names ) { + @SuppressWarnings( "unchecked" ) + Class providerClass = (Class) cl.loadClass( s ); + WeakReference> reference + = new WeakReference>(providerClass); + //keep Hibernate atop + if ( s.endsWith( "HibernatePersistence" ) && resolverClasses.size() > 0 ) { + WeakReference> movedReference = resolverClasses.get( 0 ); + resolverClasses.add( 0, reference ); + resolverClasses.add( movedReference ); + } + else { + resolverClasses.add( reference ); + } + } + } + catch ( IOException e ) { + throw new PersistenceException( e ); + } + catch ( ClassNotFoundException e ) { + throw new PersistenceException( e ); + } + } + } + + /** + * {@inheritDoc} + */ + public List getPersistenceProviders() { + //TODO find a way to cache property instances + //problem #1: avoid hard ref with classloader (List>? + //problem #2: avoid half GC lists + // todo (steve) : why arent we just caching the PersistenceProvider *instances* as the CachingPersistenceProviderResolver state??? + synchronized ( resolverClasses ) { + List providers = new ArrayList( resolverClasses.size() ); + try { + for ( WeakReference> providerClass : resolverClasses ) { + providers.add( providerClass.get().newInstance() ); + } + } + catch ( InstantiationException e ) { + throw new PersistenceException( e ); + } + catch ( IllegalAccessException e ) { + throw new PersistenceException( e ); + } + return providers; + } + } + + /** + * {@inheritDoc} + */ + public synchronized void clearCachedProviders() { + synchronized ( resolverClasses ) { + resolverClasses.clear(); + loadResolverClasses( PersistenceProviderResolverPerClassLoader.getContextualClassLoader() ); + } + } + + + private static final Pattern nonCommentPattern = Pattern.compile( "^([^#]+)" ); + + private static Set providerNamesFromReader(BufferedReader reader) throws IOException { + Set names = new HashSet(); + String line; + while ( ( line = reader.readLine() ) != null ) { + line = line.trim(); + Matcher m = nonCommentPattern.matcher( line ); + if ( m.find() ) { + names.add( m.group().trim() ); + } + } + return names; + } + } + } + +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitInfo.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitInfo.java new file mode 100644 index 000000000..9cf27856a --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitInfo.java @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +import com.fr.third.javax.persistence.SharedCacheMode; +import com.fr.third.javax.persistence.ValidationMode; +import javax.sql.DataSource; +import java.net.URL; +import java.util.List; +import java.util.Properties; + +/** + * Interface implemented by the container and used by the + * persistence provider when creating an {@link com.fr.third.javax.persistence.EntityManagerFactory}. + * + * @since Java Persistence 1.0 + */ +public interface PersistenceUnitInfo { + + /** + * Returns the name of the persistence unit. Corresponds to the + * name attribute in the persistence.xml file. + * + * @return the name of the persistence unit + */ + public String getPersistenceUnitName(); + + /** + * Returns the fully qualified name of the persistence provider + * implementation class. Corresponds to the provider element in + * the persistence.xml file. + * + * @return the fully qualified name of the persistence provider + * implementation class + */ + public String getPersistenceProviderClassName(); + + /** + * Returns the transaction type of the entity managers created by + * the EntityManagerFactory. The transaction type corresponds to + * the transaction-type attribute in the persistence.xml file. + * + * @return transaction type of the entity managers created + * by the EntityManagerFactory + */ + public PersistenceUnitTransactionType getTransactionType(); + + /** + * Returns the JTA-enabled data source to be used by the + * persistence provider. The data source corresponds to the + * jta-data-source element in the persistence.xml file or is + * provided at deployment or by the container. + * + * @return the JTA-enabled data source to be used by the + * persistence provider + */ + public DataSource getJtaDataSource(); + + /** + * Returns the non-JTA-enabled data source to be used by the + * persistence provider for accessing data outside a JTA + * transaction. The data source corresponds to the named + * non-jta-data-source element in the persistence.xml file or + * provided at deployment or by the container. + * + * @return the non-JTA-enabled data source to be used by the + * persistence provider for accessing data outside a JTA + * transaction + */ + public DataSource getNonJtaDataSource(); + + /** + * Returns the list of the names of the mapping files that the + * persistence provider must load to determine the mappings for + * the entity classes. The mapping files must be in the standard + * XML mapping format, be uniquely named and be resource-loadable + * from the application classpath. Each mapping file name + * corresponds to a mapping-file element in the + * persistence.xml file. + * + * @return the list of mapping file names that the persistence + * provider must load to determine the mappings for the entity + * classes + */ + public List getMappingFileNames(); + + /** + * Returns a list of URLs for the jar files or exploded jar + * file directories that the persistence provider must examine + * for managed classes of the persistence unit. Each URL + * corresponds to a jar-file element in the + * persistence.xml file. A URL will either be a + * file: URL referring to a jar file or referring to a directory + * that contains an exploded jar file, or some other URL from + * which an InputStream in jar format can be obtained. + * + * @return a list of URL objects referring to jar files or + * directories + */ + public List getJarFileUrls(); + + /** + * Returns the URL for the jar file or directory that is the + * root of the persistence unit. (If the persistence unit is + * rooted in the WEB-INF/classes directory, this will be the + * URL of that directory.) + * The URL will either be a file: URL referring to a jar file + * or referring to a directory that contains an exploded jar + * file, or some other URL from which an InputStream in jar + * format can be obtained. + * + * @return a URL referring to a jar file or directory + */ + public URL getPersistenceUnitRootUrl(); + + /** + * Returns the list of the names of the classes that the + * persistence provider must add to its set of managed + * classes. Each name corresponds to a named class element in the + * persistence.xml file. + * + * @return the list of the names of the classes that the + * persistence provider must add to its set of managed + * classes + */ + public List getManagedClassNames(); + + /** + * Returns whether classes in the root of the persistence unit + * that have not been explicitly listed are to be included in the + * set of managed classes. This value corresponds to the + * exclude-unlisted-classes element in the persistence.xml file. + * + * @return whether classes in the root of the persistence + * unit that have not been explicitly listed are to be + * included in the set of managed classes + */ + public boolean excludeUnlistedClasses(); + + /** + * Returns the specification of how the provider must use + * a second-level cache for the persistence unit. + * The result of this method corresponds to the shared-cache-mode + * element in the persistence.xml file. + * + * @return the second-level cache mode that must be used by the + * provider for the persistence unit + * + * @since Java Persistence 2.0 + */ + public SharedCacheMode getSharedCacheMode(); + + /** + * Returns the validation mode to be used by the persistence + * provider for the persistence unit. The validation mode + * corresponds to the validation-mode element in the + * persistence.xml file. + * + * @return the validation mode to be used by the + * persistence provider for the persistence unit + * + * @since Java Persistence 2.0 + */ + public ValidationMode getValidationMode(); + + /** + * Returns a properties object. Each property corresponds to a + * property element in the persistence.xml file. + * + * @return Properties object + */ + public Properties getProperties(); + + /** + * Returns the schema version of the persistence.xml file. + * + * @return persistence.xml schema version + * + * @since Java Persistence 2.0 + */ + public String getPersistenceXMLSchemaVersion(); + + /** + * Returns ClassLoader that the provider may use to load any + * classes, resources, or open URLs. + * + * @return ClassLoader that the provider may use to load any + * classes, resources, or open URLs + */ + public ClassLoader getClassLoader(); + + /** + * Add a transformer supplied by the provider that will be + * called for every new class definition or class redefinition + * that gets loaded by the loader returned by the + * {@link PersistenceUnitInfo#getClassLoader} method. The transformer + * has no effect on the result returned by the + * {@link PersistenceUnitInfo#getNewTempClassLoader} method. + * Classes are only transformed once within the same classloading + * scope, regardless of how many persistence units they may be + * a part of. + * + * @param transformer provider-supplied transformer that the + * container invokes at class-(re)definition time + */ + public void addTransformer(ClassTransformer transformer); + + /** + * Return a new instance of a ClassLoader that the provider may + * use to temporarily load any classes, resources, or open + * URLs. The scope and classpath of this loader is exactly the + * same as that of the loader returned by {@link + * PersistenceUnitInfo#getClassLoader}. None of the classes loaded + * by this class loader will be visible to application + * components. The provider may only use this ClassLoader within + * the scope of the {@link + * PersistenceProvider#createContainerEntityManagerFactory} call. + * + * @return temporary ClassLoader with same visibility as current + * loader + */ + public ClassLoader getNewTempClassLoader(); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitTransactionType.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitTransactionType.java new file mode 100644 index 000000000..a3874dc0f --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/PersistenceUnitTransactionType.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +/** + * Specifies whether entity managers created by the {@link + * com.fr.third.javax.persistence.EntityManagerFactory} will be JTA or + * resource-local entity managers. + * + * @since Java Persistence 1.0 + */ +public enum PersistenceUnitTransactionType { + /** + * JTA entity managers will be created. + */ + JTA, + + /** + * Resource-local entity managers will be created. + */ + RESOURCE_LOCAL +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/ProviderUtil.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/ProviderUtil.java new file mode 100644 index 000000000..525644c43 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/ProviderUtil.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; + +/** + * Utility interface implemented by the persistence provider. This + * interface is invoked by the {@link + * com.fr.third.javax.persistence.PersistenceUtil} implementation to determine + * the load status of an entity or entity attribute. + * + * @since Java Persistence 2.0 + */ +public interface ProviderUtil { + /** + * If the provider determines that the entity has been provided + * by itself and that the state of the specified attribute has + * been loaded, this method returns LoadState.LOADED. + *

    If the provider determines that the entity has been provided + * by itself and that either entity attributes with FetchType.EAGER + * have not been loaded or that the state of the specified + * attribute has not been loaded, this methods returns + * LoadState.NOT_LOADED. + *

    If a provider cannot determine the load state, this method + * returns LoadState.UNKNOWN. + *

    The provider's implementation of this method must not obtain + * a reference to an attribute value, as this could trigger the + * loading of entity state if the entity has been provided by a + * different provider. + * + * @param entity entity instance + * @param attributeName name of attribute whose load status is + * to be determined + * + * @return load status of the attribute + */ + public LoadState isLoadedWithoutReference(Object entity, String attributeName); + + /** + * If the provider determines that the entity has been provided + * by itself and that the state of the specified attribute has + * been loaded, this method returns LoadState.LOADED. + *

    If a provider determines that the entity has been provided + * by itself and that either the entity attributes with FetchType.EAGER + * have not been loaded or that the state of the specified + * attribute has not been loaded, this method returns + * return LoadState.NOT_LOADED. + *

    If the provider cannot determine the load state, this method + * returns LoadState.UNKNOWN. + *

    The provider's implementation of this method is permitted to + * obtain a reference to the attribute value. (This access is + * safe because providers which might trigger the loading of the + * attribute state will have already been determined by + * isLoadedWithoutReference. ) + * + * @param entity entity instance + * @param attributeName name of attribute whose load status is + * to be determined + * + * @return load status of the attribute + */ + public LoadState isLoadedWithReference(Object entity, String attributeName); + + /** + * If the provider determines that the entity has been provided + * by itself and that the state of all attributes for which + * FetchType.EAGER has been specified have been loaded, this + * method returns LoadState.LOADED. + *

    If the provider determines that the entity has been provided + * by itself and that not all attributes with FetchType.EAGER + * have been loaded, this method returns LoadState.NOT_LOADED. + *

    If the provider cannot determine if the entity has been + * provided by itself, this method returns LoadState.UNKNOWN. + *

    The provider's implementation of this method must not obtain + * a reference to any attribute value, as this could trigger the + * loading of entity state if the entity has been provided by a + * different provider. + * + * @param entity whose loaded status is to be determined + * + * @return load status of the entity + */ + public LoadState isLoaded(Object entity); +} diff --git a/fine-jpa/src/com/fr/third/javax/persistence/spi/package-info.java b/fine-jpa/src/com/fr/third/javax/persistence/spi/package-info.java new file mode 100644 index 000000000..204973980 --- /dev/null +++ b/fine-jpa/src/com/fr/third/javax/persistence/spi/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 + * which accompanies this distribution. The Eclipse Public License is available + * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License + * is available at http://www.eclipse.org/org/documents/edl-v10.php. + */ +package com.fr.third.javax.persistence.spi; +