• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Making Primary Keys with SQLServer/PostgreSQL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making Primary Keys with SQLServer/PostgreSQL


  • Subject: Re: Making Primary Keys with SQLServer/PostgreSQL
  • From: Jonathan Rochkind <email@hidden>
  • Date: Mon, 24 Feb 2003 13:37:16 -0600

It's the responsibility of the JDBCPlugIn subclass to provide pk support. If you are using MS SQL Server 2000, then Microsoft provides a JDBC Driver, and Apple provides a JDBCPlugIn subclass officially supported for use with MS SQL Server 2000 and Microsoft's free JDBC Driver.

If you are using another JDBC Driver, then Apple's Microsoft JDBCPlugIn _might_ work to provide PK support and other customizations neccesary for things to work right, I'm not sure, never tried it.

I wrote my own JDBCPlugIn class for use with MS SQL Server 7 and the JTurbo JDBC Driver. Microsoft's free driver seems to be only for SQL Server 2000, and I'm still on SQL Server 7. The main thing my JDBCPlugIn class does is provide PK support---through the creation of an "EO_PK_TABLE" table on the db for tracking pks. Which is the way pre-5.0 WO/EOF did things with many databases, and I'd guess the way Apple's Microsoft JDBCPlugIn works too. I tried to send my JDBCPlugIn to the list last week, but it was too large, the list rejected it.

But if you want it, email me and I can give it to you. I only know that it works with JTurbo and MS SQL Server 7. It may or may not work with another JDBC Driver, but you may be able to take just the pk-support code and use just that, perhaps modifying it so it works. Slight changes were neccesary between WO 5.0 and 5.2 to my JDBCPlugIn code, so let me know which version you want.

--Jonathan

At 08:29 PM 2/20/2003 -1000, Art Isbell wrote:
On Thursday, February 20, 2003, at 03:40  PM, Riaz Lalehzari wrote:

Whenever I try to add a new entry to a table in the db, a primary key isn't made for me and I get this error:
Adaptor com.webobjects.jdbcadaptor.JDBCAdaptor@d0357a failed to provide new primary keys for entity 'PublicSite'

On Thursday, February 20, 2003, at 06:47 PM, MJE wrote:

I'm having trouble when saving an editing context after inserting an EOGenericRecord subclass (new record/object created programatically). The error below is returned. Will I have to implement databaseContextNewPrimaryKey* for every EOEntity? Is there a better way? OpenBase takes care of this nicely, but we have to use PostgreSQL for this project.

EOF requires that primary keys be set before a new object is saved to the database, so it's best not to use whatever automatic primary key generation a database might provide. Instead, let EOModeler generate the SQL required to get the database to return primary key values and execute this SQL via EOModeler.


I know that SQLServer supports this primary key generation procedure, but I don't know whether PostgreSQL does.

Art
http://homepage.mac.com/aisbell/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Making Primary Keys with SQLServer (From: "Riaz Lalehzari" <email@hidden>)
 >Re: Making Primary Keys with SQLServer/PostgreSQL (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: Checking An Integer Is An Integer
  • Next by Date: RE: problem calling oracle stored proc
  • Previous by thread: Re: Making Primary Keys with SQLServer/PostgreSQL
  • Next by thread: PK Generation in PostgreSQL 7.3 with WO 5.1
  • Index(es):
    • Date
    • Thread