use of org.hibernate.persister.collection.BasicCollectionPersister in project hibernate-orm by hibernate.
the class ElementCollectionSortingTest method checkSQLOrderBy.
private void checkSQLOrderBy(Session session, String entityName, String propertyName, String order) {
String roleName = entityName + "." + propertyName;
String alias = "alias1";
BasicCollectionPersister collectionPersister = (BasicCollectionPersister) session.getSessionFactory().getCollectionMetadata(roleName);
Assert.assertTrue(collectionPersister.hasOrdering());
Assert.assertEquals(alias + "." + propertyName + " " + order, collectionPersister.getSQLOrderByString(alias));
}
use of org.hibernate.persister.collection.BasicCollectionPersister in project hibernate-orm by hibernate.
the class Ejb3XmlTest method testMapXMLSupport.
@Test
@SuppressWarnings("unchecked")
public void testMapXMLSupport() throws Exception {
Session s = openSession();
SessionFactory sf = s.getSessionFactory();
Transaction tx = s.beginTransaction();
// Verify that we can persist an object with a couple Map mappings
VicePresident vpSales = new VicePresident();
vpSales.name = "Dwight";
Company company = new Company();
company.conferenceRoomExtensions.put("8932", "x1234");
company.organization.put("sales", vpSales);
s.persist(company);
s.flush();
s.clear();
// For the element-collection, check that the orm.xml entries are honored.
// This includes: map-key-column/column/collection-table/join-column
BasicCollectionPersister confRoomMeta = (BasicCollectionPersister) sf.getCollectionMetadata(Company.class.getName() + ".conferenceRoomExtensions");
assertEquals("company_id", confRoomMeta.getKeyColumnNames()[0]);
assertEquals("phone_extension", confRoomMeta.getElementColumnNames()[0]);
assertEquals("room_number", confRoomMeta.getIndexColumnNames()[0]);
assertEquals("phone_extension_lookup", confRoomMeta.getTableName());
tx.rollback();
s.close();
}
Aggregations