[hibernate-commits] Hibernate SVN: r16698 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Jun 4 14:27:00 EDT 2009


Author: jcosta at redhat.com
Date: 2009-06-04 14:27:00 -0400 (Thu, 04 Jun 2009)
New Revision: 16698

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/LocalizedString.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java
Log:
ANN-840 - Added explicit not-null in foreign keys, as workaround for JBPAPP-1071

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-06-04 15:00:42 UTC (rev 16697)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Boy.java	2009-06-04 18:27:00 UTC (rev 16698)
@@ -5,9 +5,11 @@
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+
 import javax.persistence.AttributeOverride;
 import javax.persistence.AttributeOverrides;
 import javax.persistence.Column;
+import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
@@ -16,10 +18,10 @@
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
-import javax.persistence.ElementCollection;
 
 import org.hibernate.annotations.CollectionOfElements;
 import org.hibernate.annotations.IndexColumn;
+import org.hibernate.annotations.MapKey;
 
 /**
  * @author Emmanuel Bernard
@@ -79,6 +81,7 @@
 	@ElementCollection
 	@JoinTable(name = "ScorePerNickName", joinColumns = @JoinColumn(name = "BoyId"))
 	@Column(name = "score", nullable = false)
+	@MapKey(columns=@Column( name = "mapkey", nullable=false ))
 	public Map<String, Integer> getScorePerNickName() {
 		return scorePerNickName;
 	}

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/LocalizedString.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/LocalizedString.java	2009-06-04 15:00:42 UTC (rev 16697)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/LocalizedString.java	2009-06-04 18:27:00 UTC (rev 16698)
@@ -33,7 +33,7 @@
 			new HashMap<String, String>( 1 );
 
 	@ElementCollection
-	@MapKey( columns = @Column( name = "language_code" ) )
+	@MapKey( columns = @Column( name = "language_code", nullable=false ) )
 	@Fetch( FetchMode.JOIN )
 	@Filter( name = "selectedLocale",
 			condition = " language_code = :param " )

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java	2009-06-04 15:00:42 UTC (rev 16697)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/collectionelement/Matrix.java	2009-06-04 18:27:00 UTC (rev 16698)
@@ -4,6 +4,8 @@
 import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
+
+import javax.persistence.Column;
 import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -23,7 +25,7 @@
 	@GeneratedValue
 	private Integer id;
 	
-	@MapKey(type = @Type(type="integer") )
+	@MapKey(type = @Type(type="integer"), columns=@Column( name = "mapkey", nullable=false ) )
 	@ElementCollection
 	@Sort(type = SortType.NATURAL) 
 	@Type(type = "float")




More information about the hibernate-commits mailing list