1. Why doesn't JPA offer a loadChildren() method for lazily loaded relations? stackoverflow.comThere are times when I want to define a relationship as being lazily loaded, since 90% of the time I don't want the child entities, yet also have the possibility of ... |
2. Is it possible to use lazy loading with many to many relation in hibernate? stackoverflow.comhi i have two entities User and Authority they have many to many relation:
|
3. Cache issue with eagerly loaded relation forum.hibernate.orgI have the following classes: Party Code: @Entity @Table(name = "Party") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Party implements Serializable { private static final long serialVersionUID = 1L; private String name; private long version; private long id; public String getName() { ... |
4. how can I prevent the loading of both ends of a relation? forum.hibernate.org |
5. Loading one-to-many relation objects forum.hibernate.orgI assume that in your mapping file for Order contains a collection or sorts to hold the UnitDetails objects and assuming you are using Hibernate 3. Using HQL: session.createQuery("select o from Orders as o fetch join o.unitDetails").list() Using CriteriaAPI: session.createCriteria(Orders.class).setFetchMode("unitDetails", FetchMode.JOIN).list(); By default you should not enable join fetching in the mapping file for those cases where you want to lazy ... |
6. How to load an Parent Object in a key-many-to-one relation? forum.hibernate.orgHi, I would like to know what is the best way to get the data (initialize an object) from a key-many-to-one relationship. I found some problem to get data from an object in a many-to-one relationship using the key-many-to-one tag. I have theses 2 tables linked by a many-to-one relationship: AstAccountRetail have theses primary keys (composite-key) : ossAccount, astSubAccount and ossPlanType. ... |
7. Needed a |
8. Child entities also getting loaded for many-to-one relations forum.hibernate.orgDetachedCriteria mpltyCriteria = DetachedCriteria.forClass( Municipality.class, "mplty" ); mpltyCriteria.add( Restrictions.eq( "mplty.id", new Long( 1 ) ) ); mpltyCriteria.setProjection( Projections.property( "mplty.id" ) ); DetachedCriteria streetCriteria = DetachedCriteria.forClass( Street.class, "mystreet" ); streetCriteria.add( Property.forName( "mystreet.MuncipalityIDColumnINStreet" ).in( mc ) ); streetCriteria.addOrder( Order.asc( "mystreet.MuncipalityIDColumnINStreet" ) ); streetCriteria.setFirstResult( page ); streetCriteria.setMaxResults( 100 ); streetCriteria.setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ); List results = streetCriteria.getExecutableCriteria( session ).list(); |
9. Nullable many-to-one relation prevents lazy loading forum.hibernate.orgHibernate version: 3.2.4 Name and version of the database you are using: Oracle 10gR2 I have the following mappings (actual names changed): Parent table: Code: |