use of org.hibernate.mapping.PrimaryKey in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newTable.
@Override
public ITable newTable(String name) {
Table target = new Table(name);
target.setPrimaryKey(new PrimaryKey());
return facadeFactory.createTable(target);
}
use of org.hibernate.mapping.PrimaryKey in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newTable.
@Override
public ITable newTable(String name) {
Table target = new Table(name);
target.setPrimaryKey(new PrimaryKey());
return facadeFactory.createTable(target);
}
use of org.hibernate.mapping.PrimaryKey in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreateHQLQueryPlan.
@Test
public void testCreateHQLQueryPlan() {
Configuration configuration = new Configuration();
configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
Mappings mappings = configuration.createMappings();
Table t = new Table("FOO");
Column c = new Column("foo");
t.addColumn(c);
PrimaryKey key = new PrimaryKey();
key.addColumn(c);
t.setPrimaryKey(key);
Mappings m = configuration.createMappings();
SimpleValue sv = new SimpleValue(m);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
sv.setTable(t);
sv.addColumn(c);
RootClass rc = new RootClass();
rc.setEntityName("foo");
rc.setJpaEntityName("foo");
rc.setIdentifier(sv);
rc.setTable(t);
mappings.addClass(rc);
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
builder.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = builder.build();
SessionFactoryImplementor sfi = (SessionFactoryImplementor) configuration.buildSessionFactory(serviceRegistry);
Map<String, Filter> filters = Collections.emptyMap();
HQLQueryPlan hqlQueryPlan = new HQLQueryPlan("from foo", false, filters, sfi);
IHQLQueryPlan facade = facadeFactory.createHQLQueryPlan(hqlQueryPlan);
assertSame(hqlQueryPlan, ((IFacade) facade).getTarget());
}
use of org.hibernate.mapping.PrimaryKey in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreatePrimaryKey.
@Test
public void testCreatePrimaryKey() {
PrimaryKey primaryKey = new PrimaryKey();
IPrimaryKey facade = facadeFactory.createPrimaryKey(primaryKey);
assertSame(primaryKey, ((IFacade) facade).getTarget());
}
use of org.hibernate.mapping.PrimaryKey in project jbosstools-hibernate by jbosstools.
the class FacadeFactoryTest method testCreatePrimaryKey.
@Test
public void testCreatePrimaryKey() {
PrimaryKey primaryKey = new PrimaryKey(null);
IPrimaryKey facade = facadeFactory.createPrimaryKey(primaryKey);
assertSame(primaryKey, ((IFacade) facade).getTarget());
}
Aggregations