Or a protected abstract Object getPrimaryKey(Dto dto). We can get the EM over an injected QueryInvocationContext.
On Thu, May 15, 2014 at 9:06 PM, Romain Manni-Bucau <rmannibu...@gmail.com>wrote: > I think a protected findEntity(id) in the mapper can be enough. > > > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > 2014-05-07 22:29 GMT+02:00 Thomas Hug <thomas....@gmail.com>: > > Hi Romain, > > See your point. But if we only get the DTO - with what would we call the > > find? Could even be that the PK is a DTO or encoded / encrypted and needs > > to go through the mapper first. Maybe we can provide some convenience > > methods in the base mapper? > > > > > > On Tue, May 6, 2014 at 7:41 PM, Romain Manni-Bucau < > rmannibu...@gmail.com>wrote: > > > >> Hi guys, > >> > >> DTO feature is awesome but doesn't work in update mode since isNew > >> doesn't use a managed entity. > >> > >> When using a mapper we should call find and pass it to the mapper (or > >> create a new unmanaged entity if not found). So mapper signature > >> should be Entity toEntity(Entity, DTO) no? > >> > >> Otherwise users need to do the find in the mapper...almost eveytime. > >> > >> wdyt? > >> > >> > >> Romain Manni-Bucau > >> Twitter: @rmannibucau > >> Blog: http://rmannibucau.wordpress.com/ > >> LinkedIn: http://fr.linkedin.com/in/rmannibucau > >> Github: https://github.com/rmannibucau > >> >