use of org.hibernate.spatial.testing.TestDataElement in project hibernate-orm by hibernate.
the class TestStoreRetrieveUsingGeolatte method storeTestObjects.
private void storeTestObjects(Map<Integer, GeomEntity> stored) {
Session session = null;
Transaction tx = null;
int id = -1;
try {
session = openSession();
// to improve feedback in case of failure
for (TestDataElement element : testData) {
id = element.id;
tx = session.beginTransaction();
GeomEntity entity = GeomEntity.createFrom(element);
stored.put(entity.getId(), entity);
session.save(entity);
tx.commit();
}
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
throw new RuntimeException("Failed storing testsuite-suite object with id:" + id, e);
} finally {
if (session != null) {
session.close();
}
}
}
use of org.hibernate.spatial.testing.TestDataElement in project hibernate-orm by hibernate.
the class TestStoreRetrieveUsingJTS method storeTestObjects.
private void storeTestObjects(Map<Integer, GeomEntity> stored) {
Session session = null;
Transaction tx = null;
int id = -1;
try {
session = openSession();
// to improve feedback in case of failure
for (TestDataElement element : testData) {
id = element.id;
tx = session.beginTransaction();
GeomEntity entity = GeomEntity.createFrom(element);
stored.put(entity.getId(), entity);
session.save(entity);
tx.commit();
}
} catch (Exception e) {
if (tx != null) {
tx.rollback();
}
throw new RuntimeException("Failed storing testsuite-suite object with id:" + id, e);
} finally {
if (session != null) {
session.close();
}
}
}
use of org.hibernate.spatial.testing.TestDataElement in project hibernate-orm by hibernate.
the class SDOTestDataReader method addDataElement.
@Override
protected void addDataElement(Element element, List<TestDataElement> testDataElements) {
int id = Integer.parseInt(element.selectSingleNode("id").getText());
String type = element.selectSingleNode("type").getText();
String wkt = element.selectSingleNode("wkt").getText();
String sdo = element.selectSingleNode("sdo").getText();
TestDataElement testDataElement = new SDOTestDataElement(id, type, wkt, sdo);
testDataElements.add(testDataElement);
}
Aggregations