Hi Yuri!
I'm using postgresql 9.3, and I really had no problem in generating SQL.
I had some problems while migrating from my old server, to the new one,
because I used the wrong version of the JDBC driver, but, after correct it,
I don't have other problems.
Should you try to use another version? Just to check if there is a problem
with the JDBC adaptor.
About integration with other apps, I should advice you use SEQUENCEs. They
are useful, because they allow integration with direct queries.
As Check said, WO need to know the primaryKey for the EO created, so it
needs to use sequences directly. If you look at the SQL code generated
while insert a row, you will see:
SELECT NEXTVAL('TABLE_seq');
INSERT INTO TABLE (id, ....) VALUES (GENERATED_NUMBER, ...);
This is how WO generate next PK for EO in PostgreSQL.
In external Apps, if you don't need to know the PK, or doing works with SQL
queries, you can do it directly:
INSERT INTO TABLE (id, ...) VALUES (NEXTVAL('TABLE_seq'), ....);
Using NEXTVAL() the sequence return the next pk and increment the internal
counter.
Hope this helps you.
Best regards,
Daniele
2015-07-18 21:18 GMT+02:00 Yuri Kondratov <[email protected]>:
> Hmmm thank you Chuck for that interesting bit. It does make sense not
> using auto increment in the db with WO.
>
> I understand that this is probably not the proper way and can result in
> problems but interestingly we’ve been running an application with openbase
> for over 10 years that uses auto incrementing primary keys and everything
> seemed to be working fine. Also a previous small application I made with
> postgresql used auto incement as well and seemed alright.
>
> What happens if you want to add rows to the db from an external source
> outside of WO. Then figuring out what the next primary key should be is up
> to it. Doesn’t that create problems?
>
> I still have problems running the generated sql. I’ll continue to hand
> build the db (but without using serial datatypes this time) until someone
> has an answer
>
>
> On Jul 18, 2015, at 2:25 PM, Chuck Hill <[email protected]> wrote:
>
> Hi Yuri,
>
> Those instructions are 10 years out of date and refer to technologies
> that no longer exist. Those WikiBook pages only exist because the site
> owners won’t allow them to be deleted.
>
> AND you can NOT use auto-incrementing columns as primary keys with EOF.
> That does not work. EOF needs to know the PK when it commits the INSERT
> statements.
>
> Modern documentation is here: http://www.wocommunity.org
>
>
> Chuck
>
> From: <[email protected]> on
> behalf of Yuri Kondratov <[email protected]>
> Date: Saturday, July 18, 2015 at 10:50 AM
> To: WebObjects Development <[email protected]>
> Subject: postgresql eomodeler correctly "generate sql"
>
> Greetings everyone,
>
> This is mostly directed to those that use Postgresql.
>
> I’m using postgresql 9.4. In EOModeler using prototypes. Everything
> works fine other than when I try to generate sql, it seems to be generating
> it incorrectly. For example: id is generated with the integer(int4)
> datatype instead of serial (which is for autoincrementing). I do see that
> EOModeler tries to generate sequences which may be an alternative to just
> having a serial datatype. But never the less, the sql generated doesn’t
> run. It throws errors.
>
> I started reading about setting up postgresql in the documentation and
> it says: "These instructions are especially for those wanting to use
> PostgreSQL with primary keys of type serial.”. Then proceeds to say that
> EOMBundles should be placed into /Developer/ (
> https://en.wikibooks.org/wiki/WebObjects/EOF/Using_EOF/Database_Adaptors_and_Plugins
> )
>
> "Currently the Wonder build server does not autobuild the piece (coming
> soon). This is only needed for generating SQL out of EOModeler, so if
> you're just deploying, this isn't necessary. To use the EOModeler Bundle,
> checkout Project Wonder from its SourceForge repository (you can just
> checkout Wonder/PlugIns if you don't want everything). Go into the
> PostgresPlugInBundle folder and run xcodebuild, or load the project into
> Xcode and build it from the GUI. This will produce a
> build/Default/PostgresqlPlugIn.EOMplugin folder that you can copy into your
> /Developer/EOMBundles folder. Note that you CANNOT put it into your
> ~/Devloper/EOMBundles folder because EOModeler decides it doesn't want to
> look in that folder.” (
> https://en.wikibooks.org/wiki/WebObjects/Project_WONDER/Frameworks/PostgresqlPlugin
> )
>
> I can’t seem to connect to the SourceForge repository so I downloaded
> the wonder source from github and can’t seem to find the
> PostgresPlugInBundle folder. I went back and tried finding it in the Wonder
> 5 Legacy source as well. Still no luck.
>
> I have all the other steps complete such as having
> the PostgresqlPlugIn.framework in /Library/Frameworks.
>
> Anyone have any answers or suggestions?
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/ildenae%40gmail.com
>
> This email sent to [email protected]
>
--
Daniele Corti
--
I DON'T DoubleClick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]