Here I am.
I've now understood the two different approaches and I can tell you
that using the Ebean Java Agent everything works fine, instead,
removing the VM arguments to load the java agent (which, if I've
correctly understood, makes eBean to use SubClass generation), the
exception is triggered on the second Ebean.save() call.
This time I've used H2 db engine and so the exception is a bit
different, but the problem should be exactly the same:
org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
"PRIMARY_KEY_F ON PUBLIC.CERTIFICATE(ID)"; SQL statement:
insert into certificate (id, name) values (?,?)
Here's my very simple code:
- Entity Class:
http://pastebin.com/xLdWp8G7
- Simple test which raises the error:
http://pastebin.com/w38LhFi6
Thanks!
Andrea
On Jun 7, 1:46 pm, Epper <
m.ep...@gmail.com> wrote:
> Thank you very much for the explaination. I'll check and I'll let you know.
> (In the mean time I'll post here the source code to reproduce the error)
>
>
>
> On Mon, Jun 7, 2010 at 4:30 AM, Rob Bygrave <
robin.bygr...@gmail.com> wrote:
> > BTW: Without the @Version Ebean save() will check the Id value to determine
> > insert or update so I'd be interested to see the code that you have used.
>
> > Ta, Rob.
>
> > On Mon, Jun 7, 2010 at 2:27 PM, Rob Bygrave <
robin.bygr...@gmail.com>wrote:
>
> >> There are 2 ways of using Ebean:
>
> >> 1. Enhancement ... via javaagent, ant task, maven plugin, IDE (Eclipse or
> >> IDEA) plugin.
>
> >> What this means is that the actual byte codes of the entity beans are
> >> modified.
>
> >> 2. Subclass generation / "Dynamic Proxies" ...
>
> >> Ebean generates extra classes using its own class loader. Hibernate and
> >> OpenJPA also support this approach.
>
> >> The best description of these 2 approaches (pro's, con's etc) is in the
> >> reference pdf guide. So have a look through that and fire back any questions
> >> after that.
>
> >> Cheers, Rob.
>