users@glassfish.java.net

Re: JPA Recursive Updates for One-to-Many and Many-To-One Relationships

From: <glassfish_at_javadesktop.org>
Date: Sun, 24 Feb 2008 21:03:29 PST

Toplink DOES have specific support for the SqlServer platform.

And it should support the IDENTITY data type.

However, it may not be properly detecting your platform. (I don't know how it does this...)

This:
http://docs.sun.com/app/docs/doc/819-3659/6n5s6m595?a=view

Talks about how to specify the platform for you application, you may want to try specifying the SQLServerPlatform.

Also, make sure that your sequences are set up properly (i.e. GenerationType.IDENTITY). I've never used it myself, so can't share the specifics.

I would like to think this would help resolve the issues you're having.

Note, that while the DB requires the keys to make the relationships, Toplink per se does not. That's why you can create trees of objects out of whole cloth (ie. all objects are new) and Toplink does the right thing in terms of inserting data in the proper order and assigning keys.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=260658