dynamic « Load « JPA Q&A

1. Programmatically loading Entity classes with JPA 2.0?    stackoverflow.com

With Hibernate you can load your Entity classes as:

sessionFactory = new AnnotationConfiguration()

2. dynamically lazy loading of objects does not work    stackoverflow.com

I am using spring + hibernate in my project; I have two classes Reminder and Client in class reminder i have added a relationship of many to one for client and it ...

3. Lazy loading the 'one' end dynamically specified in HQL    forum.hibernate.org

I have a many-to-one association where the 'one' side is usually loaded eagerly, but for one query it should be loaded lazily. Is it possible to specify this fetching behavior dynamically for a specific HQL query? With he Criteria API, you can use Criteria#setFetchMode(...). But I need a solution using HQL. And, I do not want to specify the lazy loading ...

4. dynamically loading fields from table    forum.hibernate.org

Hi, I am looking to dynamically load the data for the entire record shown below without actually specifying each property in the mapping XML file. This is a requirement of the program that I am writing, as the Hibernate code must work without configuration modification if columns are added to or take out of the database. Is this possible? I noticed ...

5. loading dynamically graph class with collections    forum.hibernate.org

Criteria criteria = session.createCriteria(A.class); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); criteria.setFetchMode("collectionB", FetchModel.JOIN); criteria.createCriteria("collectionB", aliasB) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .setFetchMode("collectionC", FetchModel.JOIN); criteria.createCriteria("aliasB.collectionC", aliasC) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .setFetchMode("collectionD", FetchModel.JOIN);

6. Using a dynamic HSQL query to load a class    forum.hibernate.org

Hibernate version:3.0 Mapping documents: Name and version of the database you are using: Sybase 12.0 Is it possible to populate a class that is not directly mapped to any database object ...

7. turning lazy loading on/off dynamically?    forum.hibernate.org

dear hibernate experts, i have a User class with a list of UserImages. sometimes i want the UserImages loaded non-lazy (to avoid n+1 selects) and sometimes i want them loaded lazy. can you please point me to the right part of the documentation? i cannot find anything. perhaps i am a google idiot. thank you. adam

8. dynamic loading    forum.hibernate.org

hi all, for my application, there is a situation that say for user1 i have to use the three (may be name, age, address) columns of the table but for user2 i have to use these three plus some more columns from the same table. is there a way to load or map the table columns dynamically. thanx

9. load() not retrieving collections for dynamic entity    forum.hibernate.org

load doesn't usually return null if an object is not found as it will throw an exception when you try to access properties of the non-existent object. Session.get however will return null if the object you requested isn't found in the database. Nonetheless, have you tried something like: UserEntity entity = (UserEntity) session.load(UserEntity.class, id);

10. Mapping and loading a table dynamically in runtime    forum.hibernate.org

Hi ppl, I'm working on a system that creates identical tables, one per day. The table name follows a pattern. I know it's a strange data model, but... does anyone know if it's possible to map and load the table in runtime, considering the format of the table is constant ? Thanks in advance for some help

11. Loading the config file dynamically    forum.hibernate.org

Newbie Joined: Thu Aug 27, 2009 3:56 pm Posts: 10 I'm trying desperately to get hibernate to load the hibernate.cfg.xml file from a path I set in the class that does all the factory configuration. It's not working. Here's the guts of the class that's supposed to do that: Code: private static Logger log = Logger.getLogger(MMHibernateSessionFactoryAnnotations.class.getName()); ...