JPA @ManyToMany on only one side?

The error seems to be in the code that you left out with.

The error seems to be in the code that you left out with ... I am assuming that project actually did come out of the database (making persist a noop), otherwise you should be getting a hibernate exception when you try to refresh an entity that hasn't been committed yet. There seems to just be some confusion here about the difference between JDBC and ORM and what an EntityManager actually does. Em.

Persist is not a SQL insert or a SQL update. It says 'take this new entity and put it in the managed state. ' Usually that eventually leads to a SQL insert, but that's not what it means at the application level.It looks like you're essentially telling hibernate "I made some changes to this, next time the session is synchronized please persist them, oh, you know what, I changed my mind, revert back to what's in the database.

" em. Persist does not directly put anything in the database, what's there is probably still "nothing". Try tossing an em.

Flush in before your refresh and you should see your Users. (You haven't said anything about how your session is configure or how you're managing transactions, so I'm assuming all of this is in one transaction.).

Thanks... em.flush() did the trick! – Ethan Leroy May 10 '10 at 17:59 One is curious what is the functionality you're trying to achieve? Experimenting with that is an interesting academic investigation of how ORM works, but I don't know why you'd actually want to do it.

– Affe May 10 '10 at 18:08 for UnitTesting... – Ethan Leroy May 11 '10 at 1:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions