Because Hibernate raises an exception if you call persist on an already existing entry.
On 3 mars 2012, at 11:54, Guillaume SCHEIBEL wrote:
Ok greate, so why the engine calls getTuple when I perform a persist
if it's to check that the object to persist is already existing ?
Guillaume
2012/3/3 Emmanuel Bernard <emmanuel(a)hibernate.org>
OGM-40 will add those, it's next on my todo list. But you should not have do read the
DB to know if an object is already there. That's the job of the hibernate engine and
it is reflected in the dialect API. If you are missing something, let me know.
On 3 mars 2012, at 11:32, Guillaume SCHEIBEL <guillaume.scheibel(a)gmail.com> wrote:
> Hello,
>
> For example, you you try to persist an object the method "public Tuple
> getTuple(EntityKey key)" is called but you cannot try to look into the
> database to check whether the persisted object already exists or not
> because the EntityKey class doesn't provide any getter method about the
> table or the id.
>
> Is there a different way (that I didn't see) to do that or create the
> getters is the good (and the simplest) solution ?
>
> Guillaume
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev