Hibernate SVN: r10903 - branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 17:12:54 -0500 (Thu, 30 Nov 2006)
New Revision: 10903
Modified:
branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml
Log:
ANN-430 refine donc on LAZY/EAGER
Modified: branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-11-30 21:54:27 UTC (rev 10902)
+++ branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/entity.xml 2006-11-30 22:12:54 UTC (rev 10903)
@@ -1700,7 +1700,7 @@
more information on cascading and create/merge semantics.</para>
</sect3>
- <sect3>
+ <sect3 id="entity-mapping-association-fetching" revision="1">
<title>Association fetching</title>
<para>You have the ability to either eagerly or lazily fetch
@@ -1708,11 +1708,20 @@
to <literal>FetchType.LAZY</literal> or
<literal>FetchType.EAGER</literal>. <literal>EAGER</literal> will try
to use an outer join select to retrieve the associated object, while
- <literal>LAZY</literal> is the default and will only trigger a select
- when the associated object is accessed for the first time. EJBQL also
- has a <literal>fetch</literal> keyword that allows you to override
- laziness when doing a particular query. This is very useful to improve
- performance and is decided on a use case to use case basis.</para>
+ <literal>LAZY</literal> will only trigger a select when the associated
+ object is accessed for the first time. <literal>@OneToMany</literal>
+ and <literal>@ManyToMany</literal> associations are defaulted to
+ <literal>LAZY</literal> and <literal>@OneToOne</literal> and
+ <literal>@ManyToOne</literal> are defaulted to
+ <literal>EAGER</literal>. For more information about static fetching,
+ check <xref linkend="entity-hibspec-singleassoc-fetching" />. </para>
+
+ <para>The recommanded approach is to use <literal>LAZY</literal> onn
+ all static fetching definitions and override this choice dynamically
+ through JPA-QL. JPA-QL has a <literal>fetch</literal> keyword that
+ allows you to override laziness when doing a particular query. This is
+ very useful to improve performance and is decided on a use case to use
+ case basis.</para>
</sect3>
</sect2>
@@ -2693,7 +2702,8 @@
alter table Child add constraint FK_PARENT foreign key (parent_id) references Parent</programlisting>
- <sect3>
+ <sect3 id="entity-hibspec-singleassoc-fetching"
+ label="Lazy options and fetching modes">
<title>Lazy options and fetching modes</title>
<para>EJB3 comes with the <literal>fetch</literal> option to define
@@ -2806,7 +2816,7 @@
</listitem>
<listitem>
- the where clause, using @Where (applied on the target entity) or @WhereJoinTable (applied on the association table)
+ the where clause, using @Where (applied on the target entity) or @WhereJoinTable (applied on the association table)
</listitem>
<listitem>
17 years, 10 months
Hibernate SVN: r10902 - branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 16:54:27 -0500 (Thu, 30 Nov 2006)
New Revision: 10902
Added:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/Generation.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationGroup.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationUser.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/MapKeyTest.java
Log:
HHH-2275 + ANN-450 tests
Added: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/Generation.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/Generation.java 2006-11-30 21:50:48 UTC (rev 10901)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/Generation.java 2006-11-30 21:54:27 UTC (rev 10902)
@@ -0,0 +1,27 @@
+//$Id: $
+package org.hibernate.test.annotations.indexcoll;
+
+import javax.persistence.Embeddable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Embeddable
+public class Generation {
+
+ private String age;
+ private String culture;
+
+ public String getAge() {
+ return age;
+ }
+ public void setAge(String age) {
+ this.age = age;
+ }
+ public String getCulture() {
+ return culture;
+ }
+ public void setCulture(String culture) {
+ this.culture = culture;
+ }
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationGroup.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationGroup.java 2006-11-30 21:50:48 UTC (rev 10901)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationGroup.java 2006-11-30 21:54:27 UTC (rev 10902)
@@ -0,0 +1,37 @@
+//$Id: $
+package org.hibernate.test.annotations.indexcoll;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class GenerationGroup {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ private Generation generation;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Generation getGeneration() {
+ return generation;
+ }
+
+ public void setGeneration(Generation generation) {
+ this.generation = generation;
+ }
+
+
+}
\ No newline at end of file
Added: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationUser.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationUser.java 2006-11-30 21:50:48 UTC (rev 10901)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/GenerationUser.java 2006-11-30 21:54:27 UTC (rev 10902)
@@ -0,0 +1,43 @@
+//$Id: $
+package org.hibernate.test.annotations.indexcoll;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.persistence.OneToMany;
+import javax.persistence.Id;
+import javax.persistence.Entity;
+import javax.persistence.MapKey;
+import javax.persistence.GeneratedValue;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class GenerationUser {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @OneToMany
+ @MapKey(name="generation")
+ private Map<Generation, GenerationGroup> ref = new HashMap<Generation, GenerationGroup>();
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Map<Generation, GenerationGroup> getRef() {
+ return ref;
+ }
+
+ public void setRef(Map<Generation, GenerationGroup> ref) {
+ this.ref = ref;
+ }
+
+
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/MapKeyTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/MapKeyTest.java 2006-11-30 21:50:48 UTC (rev 10901)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/MapKeyTest.java 2006-11-30 21:54:27 UTC (rev 10902)
@@ -0,0 +1,40 @@
+//$Id: $
+package org.hibernate.test.annotations.indexcoll;
+
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class MapKeyTest extends TestCase {
+
+ public void testMapKeyOnEmbeddedId() {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Generation c = new Generation();
+ c.setAge( "a" );
+ c.setCulture( "b" );
+ GenerationGroup r = new GenerationGroup();
+ r.setGeneration( c );
+ s.persist( r );
+ GenerationUser m = new GenerationUser();
+ s.persist( m );
+ m.getRef().put( c, r );
+ s.flush();
+ s.clear();
+
+ m = (GenerationUser) s.get( GenerationUser.class, m.getId() );
+ assertEquals( "a", m.getRef().keySet().iterator().next().getAge() );
+ tx.rollback();
+ s.close();
+ }
+
+ protected Class[] getMappings() {
+ return new Class[] {
+ GenerationUser.class,
+ GenerationGroup.class
+ };
+ }
+}
17 years, 10 months
Hibernate SVN: r10901 - branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/collection
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 16:50:48 -0500 (Thu, 30 Nov 2006)
New Revision: 10901
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
Log:
HHH-2275
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2006-11-30 21:50:35 UTC (rev 10900)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2006-11-30 21:50:48 UTC (rev 10901)
@@ -897,7 +897,7 @@
.addCondition( getIndexColumnNames(), "=?" )
.addCondition( indexFormulas, "=?" )
.addColumns( getElementColumnNames(), elementColumnAliases )
- .addColumns( indexFormulas, elementColumnAliases )
+ .addColumns( indexFormulas, indexColumnAliases )
.toStatementString();
}
17 years, 10 months
Hibernate SVN: r10900 - trunk/Hibernate3/src/org/hibernate/persister/collection
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 16:50:35 -0500 (Thu, 30 Nov 2006)
New Revision: 10900
Modified:
trunk/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
Log:
HHH-2275
Modified: trunk/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2006-11-30 20:11:49 UTC (rev 10899)
+++ trunk/Hibernate3/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2006-11-30 21:50:35 UTC (rev 10900)
@@ -897,7 +897,7 @@
.addCondition( getIndexColumnNames(), "=?" )
.addCondition( indexFormulas, "=?" )
.addColumns( getElementColumnNames(), elementColumnAliases )
- .addColumns( indexFormulas, elementColumnAliases )
+ .addColumns( indexFormulas, indexColumnAliases )
.toStatementString();
}
17 years, 10 months
Hibernate SVN: r10899 - branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/resources
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 15:11:49 -0500 (Thu, 30 Nov 2006)
New Revision: 10899
Added:
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/resources/DefaultValidatorMessages_nl.properties
Log:
ANN-445 nl translation
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/resources/DefaultValidatorMessages_nl.properties
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/resources/DefaultValidatorMessages_nl.properties 2006-11-30 19:57:18 UTC (rev 10898)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/resources/DefaultValidatorMessages_nl.properties 2006-11-30 20:11:49 UTC (rev 10899)
@@ -0,0 +1,13 @@
+validator.assertFalse=is niet geldig
+validator.assertTrue=is niet geldig
+validator.future=moet een datum in de toekomst zijn
+validator.length=moet tussen {min} en {max} lang zijn
+validator.max=moet kleiner of gelijk aan {value} zijn
+validator.min=moet groter of gelijk aan {value} zijn
+validator.notNull=mag niet leeg zijn
+validator.past=moet een datum in het verleden zijn
+validator.pattern=moet overeenkomen met "{regex}"
+validator.range=moet tussen {min} en {max} zijn
+validator.size=moet tussen {min} en {max} groot zijn
+validator.email=moet een geldig e-mail adres zijn
+validator.notEmpty=mag niet null of leeg zijn
\ No newline at end of file
17 years, 10 months
Hibernate SVN: r10898 - in branches/Branch_3_2: Hibernate3/src/org/hibernate/mapping HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 14:57:18 -0500 (Thu, 30 Nov 2006)
New Revision: 10898
Added:
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/GroupWithSet.java
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/mapping/Collection.java
branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
Log:
HHH-2274 use ordered collection when manyToManyOrderBy is used
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/mapping/Collection.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/mapping/Collection.java 2006-11-30 19:56:14 UTC (rev 10897)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/mapping/Collection.java 2006-11-30 19:57:18 UTC (rev 10898)
@@ -599,7 +599,7 @@
}
public boolean hasOrder() {
- return orderBy!=null;
+ return orderBy!=null || manyToManyOrderBy!=null;
}
public void setComparatorClassName(String comparatorClassName) {
Added: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/GroupWithSet.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/GroupWithSet.java 2006-11-30 19:56:14 UTC (rev 10897)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/GroupWithSet.java 2006-11-30 19:57:18 UTC (rev 10898)
@@ -0,0 +1,60 @@
+//$Id$
+package org.hibernate.test.annotations.manytomany;
+
+import java.util.Collection;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+
+import org.hibernate.annotations.Where;
+import org.hibernate.annotations.FilterDef;
+import org.hibernate.annotations.Filter;
+import org.hibernate.annotations.FilterJoinTable;
+import org.hibernate.annotations.WhereJoinTable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Table(name = "tbl_group")
+@FilterDef(name="Groupfilter")
+public class GroupWithSet {
+ private Integer id;
+ private Set<Permission> permissions;
+
+ @Id
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @ManyToMany(cascade = CascadeType.PERSIST)
+ @JoinTable(name = "GROUPS_PERMISSIONS",
+ uniqueConstraints = @UniqueConstraint(columnNames = {"group_id", "permission"}),
+ joinColumns = @JoinColumn(name = "group_id", referencedColumnName = "id"),
+ inverseJoinColumns = @JoinColumn(name = "permission", referencedColumnName = "permission")
+ )
+ @OrderBy("expirationDate")
+ @Where(clause = "1=1")
+ @WhereJoinTable(clause = "2=2")
+ @Filter(name="Groupfilter", condition = "3=3")
+ @FilterJoinTable(name="Groupfilter", condition = "4=4")
+ public Set<Permission> getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(Set<Permission> permissions) {
+ this.permissions = permissions;
+ }
+}
Modified: branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2006-11-30 19:56:14 UTC (rev 10897)
+++ branches/Branch_3_2/HibernateExt/metadata/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2006-11-30 19:57:18 UTC (rev 10898)
@@ -465,6 +465,45 @@
s.close();
}
+ public void testAssociationTableAndOrderByWithSet() throws Exception {
+ Session s = openSession();
+ s.enableFilter( "Groupfilter" );
+
+ Permission readAccess = new Permission();
+ readAccess.setPermission( "read" );
+ readAccess.setExpirationDate( new Date() );
+
+ Permission writeAccess = new Permission();
+ writeAccess.setPermission( "write" );
+ writeAccess.setExpirationDate( new Date( new Date().getTime() - 10*60*1000 ) );
+
+ Permission executeAccess = new Permission();
+ executeAccess.setPermission( "execute" );
+ executeAccess.setExpirationDate( new Date( new Date().getTime() - 5*60*1000 ) );
+
+ Set<Permission> coll = new HashSet<Permission>( 3 );
+ coll.add( readAccess );
+ coll.add( writeAccess );
+ coll.add( executeAccess );
+
+ GroupWithSet group = new GroupWithSet();
+ group.setId( new Integer( 1 ) );
+ group.setPermissions( coll );
+ s.getTransaction().begin();
+ s.persist( group );
+ s.flush();
+ s.clear();
+
+ group = (GroupWithSet) s.get( GroupWithSet.class, group.getId() );
+ s.createQuery( "select g from Group g join fetch g.permissions").list();
+ Iterator<Permission> permIter = group.getPermissions().iterator();
+ assertEquals( "write", permIter.next().getPermission() );
+ assertEquals( "execute", permIter.next().getPermission() );
+ assertEquals( "read", permIter.next().getPermission() );
+ s.getTransaction().rollback();
+ s.close();
+ }
+
public void testJoinedSubclassManyToMany() throws Exception {
Session s = openSession();
Zone a = new Zone();
@@ -544,6 +583,7 @@
City.class,
Cat.class,
Group.class,
+ GroupWithSet.class,
Permission.class,
Zone.class,
Inspector.class,
17 years, 10 months
Hibernate SVN: r10897 - trunk/Hibernate3/src/org/hibernate/mapping
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 14:56:14 -0500 (Thu, 30 Nov 2006)
New Revision: 10897
Modified:
trunk/Hibernate3/src/org/hibernate/mapping/Collection.java
Log:
HHH-2274 use ordered collection when manyToManyOrderBy is used
Modified: trunk/Hibernate3/src/org/hibernate/mapping/Collection.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/mapping/Collection.java 2006-11-30 17:08:46 UTC (rev 10896)
+++ trunk/Hibernate3/src/org/hibernate/mapping/Collection.java 2006-11-30 19:56:14 UTC (rev 10897)
@@ -599,7 +599,7 @@
}
public boolean hasOrder() {
- return orderBy!=null;
+ return orderBy!=null || manyToManyOrderBy!=null;
}
public void setComparatorClassName(String comparatorClassName) {
17 years, 10 months
Hibernate SVN: r10896 - branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 12:08:46 -0500 (Thu, 30 Nov 2006)
New Revision: 10896
Modified:
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Max.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MaxValidator.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Min.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MinValidator.java
Log:
ANN-449 @Max/@Min now use long
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Max.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Max.java 2006-11-30 17:03:45 UTC (rev 10895)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Max.java 2006-11-30 17:08:46 UTC (rev 10896)
@@ -18,7 +18,7 @@
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Max {
- int value();
+ long value();
String message() default "{validator.max}";
}
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MaxValidator.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MaxValidator.java 2006-11-30 17:03:45 UTC (rev 10895)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MaxValidator.java 2006-11-30 17:08:46 UTC (rev 10896)
@@ -16,7 +16,7 @@
*/
public class MaxValidator implements Validator<Max>, PropertyConstraint, Serializable {
- private int max;
+ private long max;
public void initialize(Max parameters) {
max = parameters.value();
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Min.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Min.java 2006-11-30 17:03:45 UTC (rev 10895)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/Min.java 2006-11-30 17:08:46 UTC (rev 10896)
@@ -18,7 +18,7 @@
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Min {
- int value();
+ long value();
String message() default "{validator.min}";
}
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MinValidator.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MinValidator.java 2006-11-30 17:03:45 UTC (rev 10895)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/validator/MinValidator.java 2006-11-30 17:08:46 UTC (rev 10896)
@@ -16,7 +16,7 @@
*/
public class MinValidator implements Validator<Min>, PropertyConstraint, Serializable {
- private int min;
+ private long min;
public void initialize(Min parameters) {
min = parameters.value();
17 years, 10 months
Hibernate SVN: r10895 - branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-30 12:03:45 -0500 (Thu, 30 Nov 2006)
New Revision: 10895
Added:
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/Loader.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/ResultCheckStyle.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDelete.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDeleteAll.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLInsert.java
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLUpdate.java
Log:
ANN-37 SQL Overriding support
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/Loader.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/Loader.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/Loader.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,22 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Loader Annotation for overwriting Hibernate default FIND method
+ *
+ * @author L�szl� Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface Loader {
+ /**
+ * namedQuery to use for loading
+ */
+ String namedQuery() default "";
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/ResultCheckStyle.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/ResultCheckStyle.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/ResultCheckStyle.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,13 @@
+//$Id:
+package org.hibernate.annotations;
+
+/**
+ * Possible checks on Sql Insert, Delete, Update
+ *
+ * @author L�szl� Benke
+ */
+public enum ResultCheckStyle {
+ NONE,
+ COUNT,
+ PARAM
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDelete.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDelete.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDelete.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,33 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlDelete Annotation for overwriting Hibernate default DELETE method
+ *
+ * @author L�szl� Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLDelete {
+ /**
+ * Procedure name or DELETE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDeleteAll.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDeleteAll.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLDeleteAll.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,34 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+
+/**
+ * SqlDelete Annotation for overwriting Hibernate default DELETE ALL method
+ *
+ * @author L�szl� Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RetentionPolicy.RUNTIME )
+public @interface SQLDeleteAll {
+ /**
+ * Procedure name or DELETE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLInsert.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLInsert.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLInsert.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,33 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlInsert Annotation for overwriting Hibernate default INSERT INTO method
+ *
+ * @author L�szl� Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLInsert {
+ /**
+ * Procedure name or INSERT STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
Added: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLUpdate.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLUpdate.java 2006-11-30 15:22:57 UTC (rev 10894)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/annotations/SQLUpdate.java 2006-11-30 17:03:45 UTC (rev 10895)
@@ -0,0 +1,34 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlUpdate Annotation for overwriting Hibernate default UPDATE method
+ *
+ * @author L�szl� Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLUpdate {
+
+ /**
+ * Procedure name or UPDATE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
17 years, 10 months