Hi hw, currently the way we detect new or updated entities is not perfect :-) - we're using PersitenceUnitUtil.getIdentifier(entity) != null which gives not the result you expect in this case. If you want the persist semantics from JPA, I'd recommend implementing the EntityManagerDelegate.
On Thu, Oct 2, 2014 at 9:17 AM, hwaastad <[email protected]> wrote: > Hi, > Hi, > just a question regarding save on duplicate primaries. > I have an entity with @id String id > > eks: > User > @id String id > String name > > User a = new User("id-1","name-1") > User a2 = new User("id-1","name-2") > > save(a) - OK > save(a2) - updates entity a.... > > So, If I want save(a2) to throw an exception on duplicate primary is it > best > to use the entitymanagerdelegate or add a contraintvalidator on primary? > > br hw > > > > > -- > View this message in context: > http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/Repository-save-duplicate-key-tp4659067.html > Sent from the Apache DeltaSpike Incubator Discussions mailing list archive > at Nabble.com. >
