openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elkhawajah <elkhaw...@gmail.com>
Subject entityManager.merge
Date Sat, 21 Aug 2010 15:24:55 GMT


@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!
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/entityManager-merge-tp5447762p5447762.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message