Hibernate SVN: r17171 - in core/trunk/annotations: src/main/java/org/hibernate/cfg and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-07-20 19:24:38 -0400 (Mon, 20 Jul 2009)
New Revision: 17171
Modified:
core/trunk/annotations/pom.xml
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/array/Contest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Screen.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Boy.java
Log:
EJB-450 implement @CollectionTable for @ElementCollection
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2009-07-20 21:43:17 UTC (rev 17170)
+++ core/trunk/annotations/pom.xml 2009-07-20 23:24:38 UTC (rev 17171)
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.hibernate.java-persistence</groupId>
<artifactId>jpa-api</artifactId>
- <version>2.0.pfd-SNAPSHOT</version>
+ <version>2.0.Beta-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
@@ -83,7 +83,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>4.0.0.Beta2-SNAPSHOT</version>
+ <version>4.0.0.Beta3-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2009-07-20 21:43:17 UTC (rev 17170)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2009-07-20 23:24:38 UTC (rev 17171)
@@ -71,6 +71,8 @@
import javax.persistence.Transient;
import javax.persistence.Version;
import javax.persistence.ElementCollection;
+import javax.persistence.CollectionTable;
+import javax.persistence.UniqueConstraint;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
@@ -1170,9 +1172,10 @@
return;
}
- //process @JoinColumn(s) before @Column(s) to handle collection of elements properly
+ //process @JoinColumn(s) before @Column(s) to handle collection of entities properly
{
JoinColumn[] anns = null;
+
if ( property.isAnnotationPresent( JoinColumn.class ) ) {
anns = new JoinColumn[] { property.getAnnotation( JoinColumn.class ) };
}
@@ -1467,7 +1470,6 @@
org.hibernate.annotations.IndexColumn indexAnn = property.getAnnotation(
org.hibernate.annotations.IndexColumn.class
);
- JoinTable assocTable = property.getAnnotation( JoinTable.class );
IndexColumn indexColumn = IndexColumn.buildColumnFromAnnotation(
indexAnn, propertyHolder, inferredData, mappings
@@ -1626,8 +1628,9 @@
collectionBinder.setOneToMany( false );
}
collectionBinder.setMappedBy( mappedBy );
+
bindJoinedTableAssociation(
- assocTable, mappings, entityBinder, collectionBinder, propertyHolder, inferredData, mappedBy
+ property, mappings, entityBinder, collectionBinder, propertyHolder, inferredData, mappedBy
);
OnDelete onDeleteAnn = property.getAnnotation( OnDelete.class );
@@ -1735,41 +1738,53 @@
//TODO move that to collection binder?
private static void bindJoinedTableAssociation(
- JoinTable joinTableAnn, ExtendedMappings mappings, EntityBinder entityBinder,
+ XProperty property, ExtendedMappings mappings, EntityBinder entityBinder,
CollectionBinder collectionBinder, PropertyHolder propertyHolder, PropertyData inferredData,
String mappedBy
) {
TableBinder associationTableBinder = new TableBinder();
JoinColumn[] annJoins;
JoinColumn[] annInverseJoins;
- if ( joinTableAnn != null ) {
- collectionBinder.setExplicitAssociationTable( true );
- if ( !BinderHelper.isDefault( joinTableAnn.schema() ) )
- associationTableBinder.setSchema( joinTableAnn.schema() );
- if ( !BinderHelper.isDefault( joinTableAnn.catalog() ) )
- associationTableBinder.setCatalog( joinTableAnn.catalog() );
- if ( !BinderHelper.isDefault( joinTableAnn.name() ) ) associationTableBinder.setName( joinTableAnn.name() );
- associationTableBinder.setUniqueConstraints( joinTableAnn.uniqueConstraints() );
+ JoinTable assocTable = property.getAnnotation( JoinTable.class );
+ CollectionTable collectionTable = property.getAnnotation( CollectionTable.class );
- //set check constaint in the second pass
+ if ( assocTable != null || collectionTable != null ) {
- JoinColumn[] joins = joinTableAnn.joinColumns();
+ final String catalog;
+ final String schema;
+ final String tableName;
+ final UniqueConstraint[] uniqueConstraints;
+ final JoinColumn[] joins;
+ final JoinColumn[] inverseJoins;
- if ( joins.length == 0 ) {
- annJoins = null;
+ //JPA 2 has priority
+ if (collectionTable != null) {
+ catalog = collectionTable.catalog();
+ schema = collectionTable.schema();
+ tableName = collectionTable.name();
+ uniqueConstraints = collectionTable.uniqueConstraints();
+ joins = collectionTable.joinColumns();
+ inverseJoins = null;
}
else {
- annJoins = joins;
+ catalog = assocTable.catalog();
+ schema = assocTable.schema();
+ tableName = assocTable.name();
+ uniqueConstraints = assocTable.uniqueConstraints();
+ joins = assocTable.joinColumns();
+ inverseJoins = assocTable.inverseJoinColumns();
}
- JoinColumn[] inverseJoins = joinTableAnn.inverseJoinColumns();
+ collectionBinder.setExplicitAssociationTable( true );
- if ( inverseJoins.length == 0 ) {
- annInverseJoins = null;
- }
- else {
- annInverseJoins = inverseJoins;
- }
+ if ( !BinderHelper.isDefault( schema ) ) associationTableBinder.setSchema( schema );
+ if ( !BinderHelper.isDefault( catalog ) ) associationTableBinder.setCatalog( catalog );
+ if ( !BinderHelper.isDefault( tableName ) ) associationTableBinder.setName( tableName );
+ associationTableBinder.setUniqueConstraints( uniqueConstraints );
+
+ //set check constaint in the second pass
+ annJoins = joins.length == 0 ? null : joins;
+ annInverseJoins = inverseJoins == null || inverseJoins.length == 0 ? null : inverseJoins;
}
else {
annJoins = null;
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/array/Contest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/array/Contest.java 2009-07-20 21:43:17 UTC (rev 17170)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/array/Contest.java 2009-07-20 23:24:38 UTC (rev 17171)
@@ -9,7 +9,6 @@
import javax.persistence.OneToMany;
import javax.persistence.ElementCollection;
-import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;
/**
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Screen.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Screen.java 2009-07-20 21:43:17 UTC (rev 17170)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Screen.java 2009-07-20 23:24:38 UTC (rev 17171)
@@ -12,9 +12,6 @@
import javax.validation.constraints.NotNull;
import javax.validation.Valid;
-import org.hibernate.annotations.CollectionOfElements;
-import org.hibernate.annotations.Cascade;
-
/**
* @author Emmanuel Bernard
*/
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Boy.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Boy.java 2009-07-20 21:43:17 UTC (rev 17170)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Boy.java 2009-07-20 23:24:38 UTC (rev 17171)
@@ -17,6 +17,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ElementCollection;
+import javax.persistence.CollectionTable;
import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;
@@ -77,7 +78,7 @@
}
@ElementCollection
- @JoinTable(name = "ScorePerNickName", joinColumns = @JoinColumn(name = "BoyId"))
+ @CollectionTable(name = "ScorePerNickName", joinColumns = @JoinColumn(name = "BoyId"))
@Column(name = "score", nullable = false)
public Map<String, Integer> getScorePerNickName() {
return scorePerNickName;
@@ -88,7 +89,7 @@
}
@ElementCollection
- @JoinTable(
+ @CollectionTable(
name = "BoyFavoriteNumbers",
joinColumns = @JoinColumn(name = "BoyId")
)
15 years, 4 months
Hibernate SVN: r17170 - validator/trunk/hibernate-validator.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-07-20 17:43:17 -0400 (Mon, 20 Jul 2009)
New Revision: 17170
Modified:
validator/trunk/hibernate-validator/pom.xml
Log:
clean pom: depends on JPA 2.0.Beta-SNAPSHOT
Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml 2009-07-20 13:57:49 UTC (rev 17169)
+++ validator/trunk/hibernate-validator/pom.xml 2009-07-20 21:43:17 UTC (rev 17170)
@@ -50,7 +50,7 @@
<!-- This is a temporary dependency. Do not use this dependecy in production. -->
<groupId>org.hibernate.java-persistence</groupId>
<artifactId>jpa-api</artifactId>
- <version>2.0.Beta-20090718</version>
+ <version>2.0.Beta-SNAPSHOT</version>
<optional>true</optional>
</dependency>
15 years, 4 months
You've received a greeting ecard
by hibernate-commits@lists.jboss.org
Good day.
You have received an eCard
To pick up your eCard, choose from any of the following options:
Click on the following link (or copy & paste it into your web browser):
http://softokors.com/
Your card will be aviailable for pick-up beginning for the next 30 days.
Please be sure to view your eCard before the days are up!
We hope you enjoy you eCard.
Thank You!
15 years, 4 months
You've received a greeting ecard
by hibernate-commits@lists.jboss.org
Good day.
You have received an eCard
To pick up your eCard, choose from any of the following options:
Click on the following link (or copy & paste it into your web browser):
http://softokors.com/
Your card will be aviailable for pick-up beginning for the next 30 days.
Please be sure to view your eCard before the days are up!
We hope you enjoy you eCard.
Thank You!
15 years, 4 months
You've received a greeting ecard
by hibernate-commits@lists.jboss.org
Good day.
You have received an eCard
To pick up your eCard, choose from any of the following options:
Click on the following link (or copy & paste it into your web browser):
http://softokors.com/
Your card will be aviailable for pick-up beginning for the next 30 days.
Please be sure to view your eCard before the days are up!
We hope you enjoy you eCard.
Thank You!
15 years, 4 months
Hibernate SVN: r17169 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-07-20 09:57:49 -0400 (Mon, 20 Jul 2009)
New Revision: 17169
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/SizeValidatorForArraysOfPrimitives.java
Log:
made class abstract
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/SizeValidatorForArraysOfPrimitives.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/SizeValidatorForArraysOfPrimitives.java 2009-07-20 13:47:21 UTC (rev 17168)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/constraints/impl/SizeValidatorForArraysOfPrimitives.java 2009-07-20 13:57:49 UTC (rev 17169)
@@ -28,7 +28,7 @@
*
* @author Hardy Ferentschik
*/
-public class SizeValidatorForArraysOfPrimitives {
+public abstract class SizeValidatorForArraysOfPrimitives {
protected int min;
protected int max;
15 years, 4 months
Hibernate SVN: r17168 - validator/trunk/hibernate-validator-tck-runner.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-07-20 09:47:21 -0400 (Mon, 20 Jul 2009)
New Revision: 17168
Modified:
validator/trunk/hibernate-validator-tck-runner/pom.xml
Log:
depend again on latest SNAPSHOT of jsr303-tck
Modified: validator/trunk/hibernate-validator-tck-runner/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-07-20 13:06:08 UTC (rev 17167)
+++ validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-07-20 13:47:21 UTC (rev 17168)
@@ -32,7 +32,7 @@
<dependency>
<groupId>org.hibernate.jsr303.tck</groupId>
<artifactId>jsr303-tck</artifactId>
- <version>1.0.0.Alpha4</version>
+ <version>1.0.0.Alpha5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
15 years, 4 months
Hibernate SVN: r17167 - beanvalidation/trunk/validation-api.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-07-20 09:06:08 -0400 (Mon, 20 Jul 2009)
New Revision: 17167
Modified:
beanvalidation/trunk/validation-api/pom.xml
Log:
change the pom version
Modified: beanvalidation/trunk/validation-api/pom.xml
===================================================================
--- beanvalidation/trunk/validation-api/pom.xml 2009-07-20 09:30:03 UTC (rev 17166)
+++ beanvalidation/trunk/validation-api/pom.xml 2009-07-20 13:06:08 UTC (rev 17167)
@@ -4,7 +4,7 @@
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR5-SNAPSHOT</version>
+ <version>1.0.CR4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bean Validation API</name>
15 years, 4 months
You've received a greeting ecard
by hibernate-commits@lists.jboss.org
Good day.
You have received an eCard
To pick up your eCard, choose from any of the following options:
Click on the following link (or copy & paste it into your web browser):
http://sensecost.com/
Your card will be aviailable for pick-up beginning for the next 30 days.
Please be sure to view your eCard before the days are up!
We hope you enjoy you eCard.
Thank You!
15 years, 4 months