openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de.INVALID>
Subject Re: Primary key string ids are stripped
Date Sat, 27 Oct 2018 15:08:39 GMT
 'not able to find it right after'
+1 to what Matthew said. We need a bit more info.
Say you have the following code:
Customer c = new Customer();c.setName("Bla");em.persist(c);Long id = c.getId();
is this about what you did?
Plus: what enhancement strategy do you use? And what @GenerationType if any on the @Id?

There are now so many different scenarios out there that it might be better if you could provide
parts of your code in a sample.
LieGrue,strub

    On Friday, 26 October 2018, 09:55:37 CEST, Matthew Broadhead <matthew.broadhead@nbmlaw.co.uk.INVALID>
wrote:  
 
 can you give a small example?  do you mean when the field annotated @Id 
is a String then find returns null?

On 25/10/2018 02:34, Pawel Veselov wrote:
> Hello.
>
> I just found out, the hard way, that OpenJPA strips the string entity
> IDs when doing find().
> It doesn't strip those values when saving entities with corresponding
> primary keys.
> Is there a particular reason for this? It sounds weird to create an
> entity with primary key "0\t", but then not be able to find it right
> after....
>
> Thank you,
>    Pawel.

  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message