Search in sources :

Example 1 with MapKeyColumn

use of javax.persistence.MapKeyColumn in project hibernate-orm by hibernate.

the class Ejb3XmlElementCollectionTest method testMapKeyColumnAllAttributes.

@Test
public void testMapKeyColumnAllAttributes() throws Exception {
    reader = getReader(Entity3.class, "field1", "element-collection.orm13.xml");
    assertAnnotationPresent(ElementCollection.class);
    assertAnnotationNotPresent(MapKey.class);
    assertAnnotationNotPresent(MapKeyClass.class);
    assertAnnotationNotPresent(MapKeyTemporal.class);
    assertAnnotationNotPresent(MapKeyEnumerated.class);
    assertAnnotationPresent(MapKeyColumn.class);
    assertAnnotationNotPresent(MapKeyJoinColumns.class);
    assertAnnotationNotPresent(MapKeyJoinColumn.class);
    MapKeyColumn keyColAnno = reader.getAnnotation(MapKeyColumn.class);
    assertEquals("int", keyColAnno.columnDefinition());
    assertEquals("col1", keyColAnno.name());
    assertEquals("table1", keyColAnno.table());
    assertTrue(keyColAnno.nullable());
    assertFalse(keyColAnno.insertable());
    assertTrue(keyColAnno.unique());
    assertFalse(keyColAnno.updatable());
    assertEquals(50, keyColAnno.length());
    assertEquals(2, keyColAnno.precision());
    assertEquals(1, keyColAnno.scale());
}
Also used : MapKeyColumn(javax.persistence.MapKeyColumn) Test(org.junit.Test)

Example 2 with MapKeyColumn

use of javax.persistence.MapKeyColumn in project hibernate-orm by hibernate.

the class Ejb3XmlElementCollectionTest method testMapKeyColumnNoAttributes.

@Test
public void testMapKeyColumnNoAttributes() throws Exception {
    reader = getReader(Entity3.class, "field1", "element-collection.orm12.xml");
    assertAnnotationPresent(ElementCollection.class);
    assertAnnotationNotPresent(MapKey.class);
    assertAnnotationNotPresent(MapKeyClass.class);
    assertAnnotationNotPresent(MapKeyTemporal.class);
    assertAnnotationNotPresent(MapKeyEnumerated.class);
    assertAnnotationPresent(MapKeyColumn.class);
    assertAnnotationNotPresent(MapKeyJoinColumns.class);
    assertAnnotationNotPresent(MapKeyJoinColumn.class);
    MapKeyColumn keyColAnno = reader.getAnnotation(MapKeyColumn.class);
    assertEquals("", keyColAnno.columnDefinition());
    assertEquals("", keyColAnno.name());
    assertEquals("", keyColAnno.table());
    assertFalse(keyColAnno.nullable());
    assertTrue(keyColAnno.insertable());
    assertFalse(keyColAnno.unique());
    assertTrue(keyColAnno.updatable());
    assertEquals(255, keyColAnno.length());
    assertEquals(0, keyColAnno.precision());
    assertEquals(0, keyColAnno.scale());
}
Also used : MapKeyColumn(javax.persistence.MapKeyColumn) Test(org.junit.Test)

Example 3 with MapKeyColumn

use of javax.persistence.MapKeyColumn in project hibernate-orm by hibernate.

the class Ejb3XmlManyToManyTest method testMapKeyColumnNoAttributes.

@Test
public void testMapKeyColumnNoAttributes() throws Exception {
    reader = getReader(Entity3.class, "field1", "many-to-many.orm12.xml");
    assertAnnotationPresent(ManyToMany.class);
    assertAnnotationNotPresent(MapKey.class);
    assertAnnotationNotPresent(MapKeyClass.class);
    assertAnnotationNotPresent(MapKeyTemporal.class);
    assertAnnotationNotPresent(MapKeyEnumerated.class);
    assertAnnotationPresent(MapKeyColumn.class);
    assertAnnotationNotPresent(MapKeyJoinColumns.class);
    assertAnnotationNotPresent(MapKeyJoinColumn.class);
    MapKeyColumn keyColAnno = reader.getAnnotation(MapKeyColumn.class);
    assertEquals("", keyColAnno.columnDefinition());
    assertEquals("", keyColAnno.name());
    assertEquals("", keyColAnno.table());
    assertFalse(keyColAnno.nullable());
    assertTrue(keyColAnno.insertable());
    assertFalse(keyColAnno.unique());
    assertTrue(keyColAnno.updatable());
    assertEquals(255, keyColAnno.length());
    assertEquals(0, keyColAnno.precision());
    assertEquals(0, keyColAnno.scale());
}
Also used : MapKeyColumn(javax.persistence.MapKeyColumn) Test(org.junit.Test)

Example 4 with MapKeyColumn

use of javax.persistence.MapKeyColumn in project hibernate-orm by hibernate.

the class Ejb3XmlManyToManyTest method testMapKeyColumnAllAttributes.

@Test
public void testMapKeyColumnAllAttributes() throws Exception {
    reader = getReader(Entity3.class, "field1", "many-to-many.orm13.xml");
    assertAnnotationPresent(ManyToMany.class);
    assertAnnotationNotPresent(MapKey.class);
    assertAnnotationNotPresent(MapKeyClass.class);
    assertAnnotationNotPresent(MapKeyTemporal.class);
    assertAnnotationNotPresent(MapKeyEnumerated.class);
    assertAnnotationPresent(MapKeyColumn.class);
    assertAnnotationNotPresent(MapKeyJoinColumns.class);
    assertAnnotationNotPresent(MapKeyJoinColumn.class);
    MapKeyColumn keyColAnno = reader.getAnnotation(MapKeyColumn.class);
    assertEquals("int", keyColAnno.columnDefinition());
    assertEquals("col1", keyColAnno.name());
    assertEquals("table1", keyColAnno.table());
    assertTrue(keyColAnno.nullable());
    assertFalse(keyColAnno.insertable());
    assertTrue(keyColAnno.unique());
    assertFalse(keyColAnno.updatable());
    assertEquals(50, keyColAnno.length());
    assertEquals(2, keyColAnno.precision());
    assertEquals(1, keyColAnno.scale());
}
Also used : MapKeyColumn(javax.persistence.MapKeyColumn) Test(org.junit.Test)

Example 5 with MapKeyColumn

use of javax.persistence.MapKeyColumn in project hibernate-orm by hibernate.

the class Ejb3XmlOneToManyTest method testMapKeyColumnAllAttributes.

@Test
public void testMapKeyColumnAllAttributes() throws Exception {
    reader = getReader(Entity3.class, "field1", "one-to-many.orm13.xml");
    assertAnnotationPresent(OneToMany.class);
    assertAnnotationNotPresent(MapKey.class);
    assertAnnotationNotPresent(MapKeyClass.class);
    assertAnnotationNotPresent(MapKeyTemporal.class);
    assertAnnotationNotPresent(MapKeyEnumerated.class);
    assertAnnotationPresent(MapKeyColumn.class);
    assertAnnotationNotPresent(MapKeyJoinColumns.class);
    assertAnnotationNotPresent(MapKeyJoinColumn.class);
    MapKeyColumn keyColAnno = reader.getAnnotation(MapKeyColumn.class);
    assertEquals("int", keyColAnno.columnDefinition());
    assertEquals("col1", keyColAnno.name());
    assertEquals("table1", keyColAnno.table());
    assertTrue(keyColAnno.nullable());
    assertFalse(keyColAnno.insertable());
    assertTrue(keyColAnno.unique());
    assertFalse(keyColAnno.updatable());
    assertEquals(50, keyColAnno.length());
    assertEquals(2, keyColAnno.precision());
    assertEquals(1, keyColAnno.scale());
}
Also used : MapKeyColumn(javax.persistence.MapKeyColumn) Test(org.junit.Test)

Aggregations

MapKeyColumn (javax.persistence.MapKeyColumn)8 Test (org.junit.Test)6 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ElementCollection (javax.persistence.ElementCollection)1 Embeddable (javax.persistence.Embeddable)1 MapKeyJoinColumn (javax.persistence.MapKeyJoinColumn)1 AnnotationException (org.hibernate.AnnotationException)1 AssertionFailure (org.hibernate.AssertionFailure)1 LazyGroup (org.hibernate.annotations.LazyGroup)1 Loader (org.hibernate.annotations.Loader)1 OptimisticLock (org.hibernate.annotations.OptimisticLock)1 Persister (org.hibernate.annotations.Persister)1 SQLDelete (org.hibernate.annotations.SQLDelete)1 SQLDeleteAll (org.hibernate.annotations.SQLDeleteAll)1 SQLInsert (org.hibernate.annotations.SQLInsert)1 SQLUpdate (org.hibernate.annotations.SQLUpdate)1 AssertionFailure (org.hibernate.annotations.common.AssertionFailure)1 XClass (org.hibernate.annotations.common.reflection.XClass)1 XProperty (org.hibernate.annotations.common.reflection.XProperty)1