use of org.hibernate.mapping.KeyValue in project hibernate-orm by hibernate.
the class IdentityGeneratorExtendsTest method testIdentifierGeneratorExtendsIdentityGenerator.
@Test
public void testIdentifierGeneratorExtendsIdentityGenerator() {
final MetadataSources sources = new MetadataSources(serviceRegistry());
sources.addAnnotatedClass(EntityBean.class);
final MetadataBuilder builder = sources.getMetadataBuilder();
final Metadata metadata = builder.build();
for (final Namespace ns : metadata.getDatabase().getNamespaces()) {
for (final org.hibernate.mapping.Table table : ns.getTables()) {
final KeyValue value = table.getIdentifierValue();
assertNotNull("IdentifierValue was null", value);
assertTrue(value.isIdentityColumn(metadata.getIdentifierGeneratorFactory(), getDialect()));
}
}
Session s = openSession();
s.beginTransaction();
s.save(new EntityBean());
s.getTransaction().commit();
s.close();
}
use of org.hibernate.mapping.KeyValue in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testGetKey.
@Test
public void testGetKey() {
Map valueTarget = new Map(null, null);
valueFacade = FACADE_FACTORY.createValue(valueTarget);
Assert.assertNull(valueFacade.getKey());
KeyValue keyValue = new SimpleValue(null);
valueTarget.setKey(keyValue);
Assert.assertSame(keyValue, ((IFacade) valueFacade.getKey()).getTarget());
}
use of org.hibernate.mapping.KeyValue in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetKey.
@Test
public void testSetKey() {
KeyValue keyValueTarget = new SimpleValue(null);
IValue keyValueFacade = FACADE_FACTORY.createValue(keyValueTarget);
Collection collectionTarget = new Bag(null, null);
IValue collectionFacade = FACADE_FACTORY.createValue(collectionTarget);
Assert.assertNull(collectionTarget.getKey());
collectionFacade.setKey(keyValueFacade);
Assert.assertSame(keyValueTarget, collectionTarget.getKey());
}
use of org.hibernate.mapping.KeyValue in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetIdentifierValue.
@Test
public void testGetIdentifierValue() {
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
IValue valueFacade = tableFacade.getIdentifierValue();
Assert.assertNull(valueFacade);
KeyValue value = new SimpleValue(null);
table.setIdentifierValue(value);
valueFacade = tableFacade.getIdentifierValue();
Assert.assertSame(value, ((IFacade) valueFacade).getTarget());
}
use of org.hibernate.mapping.KeyValue in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetIdentifierValue.
@Test
public void testGetIdentifierValue() {
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
IValue valueFacade = tableFacade.getIdentifierValue();
Assert.assertNull(valueFacade);
KeyValue value = new SimpleValue(null);
table.setIdentifierValue(value);
valueFacade = tableFacade.getIdentifierValue();
Assert.assertSame(value, ((IFacade) valueFacade).getTarget());
}
Aggregations