persistence@glassfish.java.net

RE: Implementation Strategy

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 24 Oct 2006 16:33:46 -0400

Hello Stephen,
    TopLink JPA fully supports database generated primary keys as specified in the Java Persistence specification. What method of PK generation are you looking for sequence object or identity field? In JPA the sequencing method is specified through a combination of the @GeneratedValue annotation and the GenerationType Enum.
For example:
    @Id
    @GeneratedValue(strategy=SEQUENCE, generator="CUST_SEQ")
    @Column(name="CUST_ID")
    public Long getId() { return id; }

Also if you have pre-existing databases there should be no need to migrate to Derby, TopLink JPA will be able to access the legacy databases.
--Gordon


-----Original Message-----
From: Stephen Carpenter [mailto:stephen-hic_at_hotmail.co.uk]
Sent: Tuesday, October 24, 2006 1:28 PM
To: persistence_at_glassfish.dev.java.net
Subject: Implementation Strategy


Hi,

Will the Glassfish/Persistance API combination support the use of database
generated primary keys.
I am exploring what combination to use in the future and have been looking
at Sun App Server/Derby/Persistance API, via NetBeans 5.5. But App Server
does not support database generated primary keys. (Or am I missing something
here?).

I have a number of legacy databases to bring into the new apps (probably
Derby) and I am looking for the best combination to go forward, would
Hibernate solve the problem or do I have to go to JBoss etc or does
Glassfish resolve it ?

Your ideas would be greatly appreciated.

Thanks,

Stephen Carpenter
Jupiter Systems

_________________________________________________________________
Windows Live™ Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb