Hi there,

On 17/10/2005, at 4:59 PM, Johan Henselmans wrote:

On 17-okt-2005, at 5:44, LD wrote:

On 17/10/2005, at 3:25 AM, Colin Shreffler wrote:

I’m working on my first WO project. I’ve been trying to get it to work with PostgreSQL for some time because I believe it to be a great RDBMS, but continue to have problems. One step forward, one step back, etc. I’ve tried to use Project Wonder to solve these issues, but continue to have
problems...  I’m getting fed up!

As Anjo mentioned, it'd be good to know exactly what problems you're having.

I'm using PostgreSQL without any problems.

The trick to getting it working all boils down to the plugin. You'll want to install the PostgresqlPlugIn.EOMplugin and the PostgresqlPlugIn.framework and the correct locations (/Developer/ EOMBunles, Library/Frameworks respectively) and make sure to reference the framework in your project.

The one thing to be aware of when using the current version of the Project Wonder (and even the HexDreams version) of the PostgresqlPlugIns is that if you decide to use the "serial" column type for your primary keys (i.e., selecting these in EOModeler for a column) then the plugin won't find the correct column [1].

There's an easy fix for this (by editing the source code for the plugin). Otherwise, simply use an int type, choose to create primary key support when generating SQL from EOModeler and you should be right.


Let me know if you need more help with this...

[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

The other one used to be that one could not use the serial type, but from your comments it seems that has been resolved. I would really like if the Wonder plugin would use the available seq, however. Sometimes one has to connect to an existing database, with _seqs that are used by other programs to generate new primary keys.

Yep. As above, it's easy to fix.

I liked the hexdreams plugin better, in that respect: using the .seq tables to generate new primary keys makes it easier to play nice with other programming languages (connections through ODBC, php or perl) to generate primary keys.

I had to customise the hexdreams plugin actually to get it working...

Does the wonder postgresql-plugin still rely on an EO_PK_TABLE construction for the generation of primary keys that are not based on the serial type?

See above. As with any open-source project, you can change it to suit.

with regards,
--

LD


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to