> So I got into the console and enabled the > jpa logging but, I am not seeing anything.
I'm not positive, but I think that you may need to enable each of the particular JPA debug options in the ServerDebugMBean (via console or config.xml), and not just one global setting. So, in this situation, enabling the JDBC and SQL debug options will be useful. If you're still not seeing anything, can you post your persistence.xml file? Also, what happens if you use a different GenerationType (other than IDENTITY or SEQUENECE)? What does the schema definition for your table look like? -Patrick -- Patrick Linskey BEA Systems, Inc. _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. > -----Original Message----- > From: Dan Bush [mailto:[EMAIL PROTECTED] > Sent: Sunday, March 04, 2007 6:25 AM > To: open-jpa-dev@incubator.apache.org > Subject: Re: Missing PK Values > > The pk is being assigned in the DB. When I look up the entity with the > EM, the pk is not set in the entity correctly. In fact it's 0 and I > would have expected null any way as its a java.lang.Long, not a > primitive ... I will try the enable the logging again. I did put the > appropriate property in the persistence.xml but, WL is logging a > warning that it is going to be ignored and the logging should be > configured in the console. So I got into the console and enabled the > jpa logging but, I am not seeing anything. > > Some more facts: > > 1) I am making remote calls into a session bean that is then > interacting with an injected EM. So the transaction demarcation should > be being controlled by the container at the session bean method level. > All the methods of the session bean are of transaction type requires > by default. > > 2) I am NOT using the WLs XA Sybase driver because I have to get the > DBAs to grant some role to make it work. So for now I am using WLs non > XA driver. > > I am not positive that the EM is playing nice with JTA and maybe thats > why the pks are not being refreshed / loaded back from the db. Then > again the underlying inserts are committed. > > > On 3/4/07, Marc Prud'hommeaux <[EMAIL PROTECTED]> wrote: > > Dan- > > > > Once you commit the transaction, is the PK assigned? Can you enable > > SQL logging any show us the SQL that is executed in the transaction? > > > > Finally, if you look up the Entity using a new EntityManager, is the > > PK set correctly? > > > > > > On Mar 2, 2007, at 3:38 PM, Dan Bush wrote: > > > > > I am using WL 10T and OpenJPA(0.9.7 nightly) against a > Sybase(12.5.3) > > > DB . My PK types are IDENTITY and I have the entities > mapped like so: > > > > > > @Id > > > @GeneratedValue(strategy = GenerationType.IDENTITY) > > > @Column(name = "myPk") > > > private Long id; > > > > > > public Long getId() { // i only have a setter ... > > > return id; > > > } > > > > > > When I execute the following code, the PK comes back 0! : > > > > > > Entity e = new EntityX(); > > > > > > _em.persist(entity); > > > > > > // _em.flush(); > > > // _em.refresh() // tried this too > > > > > > System.out.println(entity.getId()); // returning 0 > > > > > > > > > > > > It doesn't look like the PKs are being relayed back from > the DB. Not > > > sure if I have a driver issue or what(using the non XA WL Sybase > > > driver). Even when I find an entity all the fields values > seam to be > > > working except for the pks. Anyone have any ideas? > > > > >