• 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: WO and MySQL --> PostgresqlPlugIn: Project Wonder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WO and MySQL --> PostgresqlPlugIn: Project Wonder


  • Subject: Re: WO and MySQL --> PostgresqlPlugIn: Project Wonder
  • From: LD <email@hidden>
  • Date: Tue, 18 Oct 2005 05:14:22 +1000

Hi there,

On 18/10/2005, at 1:54 AM, Arturo Perez wrote:

LD wrote:

[1] The postgres serial type automatically creates a sequenced called: <tableName>_<pkColumn>_SEQ whereas the current version of the plugin looks for a sequence called <tableName>_SEQ.

You might having trouble that the user that is connecting to the database does not have permission to generate new tables. The wonder plugin used to generate a EO_PK_TABLE.

You can view the source online here:
http://cvs.sourceforge.net/viewcvs.py/wonder/Wonder/PlugIns/ PostgresqlPlugIn/Sources/com/webobjects/jdbcadaptor/
PostgresqlPlugIn.java has
protected static String sequenceNameForEntity(EOEntity entity) {
return entity.primaryKeyRootName() + "_SEQ";
}
i.e., <tableName>_SEQ
Customise it as required. I suggest something like the following if you want it to be automatically compatible with using the "serial" column type sequences as created by postgres.
protected static String sequenceNameForEntity( EOEntity entiy ) {
StringBuffer sequenceName;
sequenceName = new StringBuffer();
sequenceName.append( entity.primaryKeyRootName() ); // i.e., the table name
sequenceName.append( entity.primaryKeyAttributeNames ().valueForKey( "columnName" ).componentsJoinedByString( "_" ) );
sequenceName.append( "_SEQ" );
return sequenceName.toString();
}
i.e., <tableName>_<primaryKey0>_<primaryKeyN>_SEQ. In most cases where there's a single primary key: <tableName>_<primaryKey0>_SEQ

That's pretty nice. I would suggest modifying it to detect if the column type is SERIAL and then you'll have the best of both worlds.

Well, the above is a snippet really of what I was working on a month or so ago (but haven't had time to complete. i.e., test) where I do indeed test for various sequence names the first time around; upon discovery we save it in the user info for the entity to save round- trips the next time.


I'll have to get back onto that...

with regards,
--

LD


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >WO and MySQL (From: Colin Shreffler <email@hidden>)
 >Re: WO and MySQL (From: LD <email@hidden>)
 >Re: WO and MySQL (From: Johan Henselmans <email@hidden>)
 >Re: WO and MySQL (From: LD <email@hidden>)
 >Re: WO and MySQL (From: Arturo Perez <email@hidden>)

  • Prev by Date: Re: Database replication and WO
  • Next by Date: Re: Problems deserializing EOGenericRecords via WebServices
  • Previous by thread: Re: WO and MySQL
  • Next by thread: Re: WO and MySQL
  • Index(es):
    • Date
    • Thread