null « Load « JPA Q&A





1. Session.load: HibernateException or to return null?    forum.hibernate.org

Session.load() raises an exception if the bean can't be find by its id. Is there any way to return null instead of throwing an exception. I want to use this for my testCases (and in future implementations when I want to take some action if an entity cant be found). See my test case: ---------------------------------------------- //Checks that the user was correctly ...

2. Empty lazy loaded collection set to NULL;NullPointerExceptin    forum.hibernate.org

Hi When trying to add the first object to a lazy loaded collection (Set/HashSet) I get a NullPointerException. It seems that Hibernate sets my HashSet = null when I do a myObject.getCollection(). I expect an empty HashSet, not null. So the NullPointerException comes when I try adding the object: myObject.getCollection().add(newObject); Aynone got any idea about this? I've seen several examples adding ...

3. Error when the object I am loading is null- Please help_    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: Hivernate 2 Mapping documents: Code between sessionFactory.openSession() and session.close(): Full stack trace of any exception that occurs: Name and version of the database you are using: Oracle 9 The generated SQL (show_sql=true): ok Debug level Hibernate log excerpt: This is the hibernate sql that I need so far if I tested ...

4. Need help - Error when loading an Object equal to null    forum.hibernate.org

Author Message dfini Post subject: Need help - Error when loading an Object equal to null Posted: Wed Jan 26, 2005 9:49 am Beginner Joined: Fri Jan 07, 2005 2:47 pm Posts: 45 My question: I need to load data through a request object. The request object initialiaze other objects like practitioner object. My problem is if the pratictioner ...

6. Null pointer when loading child at 3:rd level    forum.hibernate.org

Hi I have a problem with Hiberntae when doing the following. I have a Swing client whch has a parent /child structure (Using JTree). When I add a new chld I send the id over to the server of the parent and a new child to add to it. On the server I first load the parent using session.load and I ...

7. Replacing null values with empty string on load    forum.hibernate.org

I have a table with many columns containing null values. when I populate my Java object using Hibernate's query or load, the String properties are also null. I would like them to be the empty string instead of null. What is the easiest way to accomplish this? From what I've read so far in the documentation and forums, implementing the PropertyAccessor ...

8. Null value retrieved from lazy loaded proxy object    forum.hibernate.org

Hibernate fails to read value from proxy object (created due to lazy loading) when this object participate in query formation. I tried to explain the above problem with an example Lets consider four entities (sorry about class names I didnt get any good names just gave random names) Pt */ public class Pt { private Long ptId; private String ptName; private ...