JavaRanch » Java Forums »
Databases »
Object Relational Mapping
| Author |
one to one mapping problem
|
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
here is my exam class
here is me examDetail class
here is error i am getting
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
The error is happening at this line:
transaction.commit();
It might even appear that it is a problem getting the actual connection. I see a JNDI lookup there. Perhaps either the connection pool is not being obtained by the JNDI lookup, or if you've configured transactions through JNDI, the JNDI lookup on the UserTransaction object is failing.
For some reason your transaction is not committing. That's the key. Do you have any idea why that line of code might be failing?
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
I put session.save(detail); above the session.save(exam);.
now it seems llike this
then it gives this error
anyway nullpointer means it doesn't make session?
|
 |
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
It can't be JNDI problem
i am using same connection to run this example too.Still it runs well
here is my config file
Both of these examples are in same project.So they use same database connection and same schema.
But different tables
|
 |
Christian Dillinger
Ranch Hand
Joined: Jul 20, 2009
Posts: 172
|
|
I don't know if you changed your original sample, but here you never set transaction. So it's okay that you get a NPE.
In your last post you had "transaction = session.beginTransaction()".
|
 |
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
|
|
Thnks Christian Dillinger.
You are correct.
I missed that.
|
 |
 |
|
|
subject: one to one mapping problem
|
|
|
|