Hi elkhawaja,
According to the spec and our javadoc [1], you are correct.  We should be
issuing the illegalArgumentException instead of the IllegalStateException.
I'm surprised that we don't have a unit test for this situation.  Is it
possible for you to provide a testcase that demonstrates this?  Just to make
sure that we're talking about the same situation.

OpenJPA documents their APIs via javadoc [2].  When we extend the standard
JPA interfaces, we'll document the new methods and requirements via updated
javadoc.  But, when we use the standard JPA interfaces, then we'll refer
back to the javax.persistence.* package.

Additional information on OpenJPA's functionality can be found in our online
manual [3].

Depending on the application server in use, the @Transactional should be
providing the proper transactional context and there should be no reason to
explicitly invoke flush().  That is more of a question of the application
server providing this functionality, rather than the JPA provider.  Are you
indicating that this same application in the same application server is
working as expected with other JPA providers (in the context of the
transaction)?

Thanks,
Kevin


[1]
http://download.oracle.com/javaee/6/api/javax/persistence/EntityManager.html#merge(T)
[2]
http://openjpa.apache.org/builds/2.0.0/apache-openjpa-2.0.0/docs/javadoc/index.html
[3]  http://openjpa.apache.org/documentation.html

On Sat, Aug 21, 2010 at 10:45 AM, elkhawajah <[email protected]> wrote:

>
> 3) I don't know why I am not getting the exception as documented in
>
> http://download.oracle.com/javaee/5/api/javax/persistence/EntityManager.html#merge(T)<http://download.oracle.com/javaee/5/api/javax/persistence/EntityManager.html#merge%28T%29>
> .
>
> Does OpenJPA override these excpetions? as I recall in Hibernate, that if I
> passed non-existing component to merge method, I will get
> IllegalArgumentException, but heere I am getting InvalidStateException when
> calling flush.
>
> Also, unfortunatelly, I am not able to find a comprehensive documentation
> about the thrown exception from EntityManagerImpl of OpenJPA.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/entityManager-merge-tp5447762p5447804.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Reply via email to