Database « Exception « JPA Q&A

1. Why am I getting this NullPointer exception?

Two tables, primary key of one is foreign key of another (Legacy DB)
I used bi-directional one to one mapping:

public class First {
    @Id protected int a;


2. Hibernate doesn't save and doesn't throw exceptions?

I'm stuck with this already for some weeks and I don't have the faintest idea what's going wrong. I'm quite desparate as I've wasted so much time already I use the data ...

3. Could not synchronize database state with session Exception in hibernate

I have a table bean as :

public class Employee implements Serializable {

    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "employee_id", unique = true, ...

4. Hibernate: Save to Database throwing exception

Even if i make the otherIDNumber work by hardcoding the value I get the below error: org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing:; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Could you please suggest. Anyone?? Thanks, Namrita

5. Merge Bug? or Impossible to Recover from Database Exception?

Newbie Joined: Wed Jul 19, 2006 9:46 am Posts: 5 In the following a "run down" of the Testcase, which reproduces a problem we ran into with EntityManager.merge after an Database Exception. We have a Entity A has a Jpa OneToMany Relationship to Entity B The OneToMany Relationship has CasadeType.ALL In the database addtionally to the mapped Tables and Foreign Key, ...

6. Exception: Could not synchronize database state with session

Newbie Joined: Tue Dec 14, 2010 11:31 am Posts: 4 Hi, I have an web application developed on spring and hibernate 3.0 and deployed on apache tomcat 6. I am getting below error when I am trying to insert the data to the one of the table ('CAR_ATTRIBUTE' table). Code: [CAR] [2010-12-12 13:41:30,651] ERROR [http-80-2] AbstractFlushingEventListener.performExecutions(301) | Could not synchronize database ...

7. Access exception when trying to access db

Everything i`ve been doing for one week is based on hibernate docs (actually from the site). It has helped me a lot, however, i think that hibernates documentation has some scattered pieces of information that sometimes are hard to put together. When i get home from work, i`ll sure take a look at the documentation and try to solve the problem, ...

8. how to turn off logging error when DB exception occured.

Iam trying to aquire exclusive lock with refresh on request object and getting following exception which is logged to console. Iam catching exception in HibernateException catch block, Iam not logging in catch block, but Iam stll seeing the log error message on console. Is there anyway to turn off log message. [b]Hibernate version:[/b] 2.1.7 [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close():[/b] ...

9. Getting EOF exception, not database related.

Author Message princeamin Post subject: Getting EOF exception, not database related. Posted: Sat Dec 18, 2004 7:42 am Newbie Joined: Sat Mar 27, 2004 4:31 am Posts: 5 Location: Kuala Lumpur Hibernate version: 2.1 I'm not sure why is this giving an error. any suggestion, most probably you guys can look at the stack trace. Getting full object gets ...

10. DB-independent exception handling?

Hello Guys. I'm prototiping a new app, and I'm kind of stuck with this. I've seen that, when you get an exception while doing an operation with Hibernate, you can catch things like "ConstraintViolationException" , that abstracts the error condition for different engines. The problem I'm having, is that all of these return the same exception: 1. Duplicated PK/UK 2. FK ...

11. Database Error not thrown as Exception

Newbie Joined: Wed Oct 12, 2005 11:17 am Posts: 7 Need help with Hibernate? Read this first: ... AskForHelp Hibernate version: 3.0 hibernate.cfg.xml: Code: