I understand, this case my patch not enough. This breaks all clients, because the method will return a something different of the OpenJPAId. :P
On Tue, Jun 2, 2015 at 5:31 PM, Rick Curtis <[email protected]> wrote: > Please be sure to add something to openjpa.Compatibility when making this > change that allows the runtime to revert to the old behavior... I'd hate to > break existing customers that have code that expects to get an OpenJPAId. > > On Tue, Jun 2, 2015 at 2:03 PM, Mark Struberg <[email protected]> wrote: > > > txs Daniel, will check it. > > Please hesitate to ping us again as I first try to finish some work on > the > > SchemaTool. > > > > LieGrue, > > strub > > > > > Am 02.06.2015 um 20:34 schrieb Daniel Cunha <[email protected]>: > > > > > > Hi folks, > > > > > > OpenJPA always return a OpenJPAId when I call the > > > PersistenceUtil#getIdentifier, but it no make sense IMHO. > > > > > > E.g: > > > If I have an Entity that my ID is String type. > > > > > > @Entity > > > class xpto { > > > > > > @Id > > > private String id; > > > ... > > > > > > } > > > > > > The spec say: > > > > > > "Return the id of the entity. A generated id is not guaranteed to be > > > available until after the database insert has occurred. Returns null if > > the > > > entity does not yet have an id." > > > > > > This case, the impl should return the type declared in Entity. Right? > > > So, PersistenceUtil#getIdentifier should return a String value, but > > OpenJPA > > > return an StringId (StringID extends OpenJPAId). > > > > > > I attached an patch, but.. I don't know if this is enough. > > > https://issues.apache.org/jira/browse/OPENJPA-2590 > > > > > > Thank you for attention! > > > > > > On Mon, May 25, 2015 at 12:48 PM, Kevin Sutter <[email protected]> > > wrote: > > > > > >> Hi Daniel, > > >> Yes, that would be correct. If you need to get the exact type as > > defined > > >> by your entity class, then you would need to go another level deeper. > > Just > > >> to correct the link for anybody that is referencing this posting: > > >> > > >> > > > https://github.com/apache/openjpa/blob/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java > > >> > > >> Kevin > > >> > > >> On Sun, May 24, 2015 at 11:58 PM, Daniel Cunha <[email protected]> > > >> wrote: > > >> > > >>> Hi Folks, > > >>> > > >>> I have a doubt. > > >>> This method (PersistenceUnitUtil#getIdentifier) should return the > value > > >> of > > >>> id, right? > > >>> OpenJPA return a instance of OpenJPAId [StringId, LongId, > BigDecimalId > > >> and > > >>> etc ] > > >>> > > >>> This case, when ID is OpenJPAId, we need to call > OpenJPAId#getIdObject > > >>> here: > > >>> > > >>> > > >> > > > https://github.com/apache/openjpa/blob/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java#L361-L363 > > >>> no? > > >>> > > >>> > > >>> -- > > >>> Best regard, > > >>> Daniel Cunha (soro) > > >>> > > >> > > > > > > > > > > > > -- > > > Best regard, > > > Daniel Cunha (soro) > > > > > > > -- > *Rick Curtis* > -- Best regard, Daniel Cunha (soro)
