Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

entityManager.merge

elkhawajah

2010-08-21

Replies: Find Java Web Hosting

Author LoginPost Reply


@Transactional
public void createMessageType(MessageType messageType){
       getEntityManager().merge(messageType);
       getEntityManager().flush();
}

1) I am trying to write a failure test for the code above, what I am doing
is that I am passing non-existing entity to merge method.

I am getting InvalidStateException when flush method is called, my question
is shouldn't merge throw IllegalArgumentException when trying to merging
non-existing entity? why I am getting InvalidStateException?

2) I am using @Transactional annotation in the method above, but I found
that I must invoke flush explicitly, shouldn't that annotation handle
flushing instead of calling flush method explicitly?

I have uploaded
http://openjpa.208410.n2.nabble.com/file/n5447762/persistence.xml
persistence.xml , and
http://openjpa.208410.n2.nabble.com/file/n5447762/applicationContext.xml
applicationContext.xml .

Thx!
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.
©2008 gg3721.com - Jax Systems, LLC, U.S.A.