List of usage examples for org.hibernate Session bySimpleNaturalId
<T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(Class<T> entityClass);
From source file:org.apache.ignite.cache.hibernate.GridHibernateL2CacheSelfTest.java
License:Apache License
/** * @param sesFactory Session factory./*from w w w.j a va2s. c o m*/ * @param cnt Number of entities to load. */ private void loadEntities(SessionFactory sesFactory, int cnt) { Session ses = sesFactory.openSession(); try { for (int i = 0; i < cnt; i++) { Entity e = (Entity) ses.load(Entity.class, i); assertEquals("name-" + i, e.getName()); assertFalse(e.getChildren().isEmpty()); ses.bySimpleNaturalId(Entity.class).load(e.getName()); } } finally { ses.close(); } }
From source file:org.jboss.pressgang.ccms.wrapper.DBServerSettingsWrapper.java
License:Open Source License
@Override public LocaleWrapper getDefaultLocale() { if (cachedDefaultLocale == null) { final Session session = getEntityManager().unwrap(Session.class); cachedDefaultLocale = (Locale) session.bySimpleNaturalId(Locale.class) .load(getEntity().getDefaultLocale()); }/*from w ww. j a v a 2s . c om*/ return getWrapperFactory().create(cachedDefaultLocale, false, LocaleWrapper.class); }