Re: Extended class issues

2016-07-28 Thread Dougan Stuart
Sure, here’s the relevant parts: 
 
 
 
 
 
 
 
 
 
 

 I’ve created a fix for this issue in DataDomainDBDiffBuilder.appendForeignKeys on line 133 (within the nested loop): String joinSourceName = join.getSourceName(); if (dbDiff.get(joinSour

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
Thanks John. I will give it a try tomorrow. nobu On 28 July 2016 at 20:49, John Huss wrote: > Cayenne generates them like this: > > CREATE SEQUENCE mytable_seq > INCREMENT 20 > START 200; > > The start part is optional. > > On Thu, Jul 28, 2016 at 2:02 PM Harunobu Oyama wrote: > > > Sorry

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread John Huss
Cayenne generates them like this: CREATE SEQUENCE mytable_seq INCREMENT 20 START 200; The start part is optional. On Thu, Jul 28, 2016 at 2:02 PM Harunobu Oyama wrote: > Sorry, how should I create the sequence? If Cayenne increments the value in > blocks f 20? > > nobu > > > On 28 July 201

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
uh, ok, so the proper way to use it is something like this? - on CayenneModeler, choose "Custome Sequence" - name the Sequence name in any sequence name of my choice - set Cached PK size to 1 (baring in mind that it can have some performance impact) I will give it a try tomorrow. (sorry, I

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Adam Boyle
The way I have it working is by using a custom sequence for PK generation. In the dialog to set it up you can choose the "cached PK size" which determines how many PKs cayenne will grab at a time for a given transaction. If you set it to 1 it will only grab one at a time, but keep in mind that t

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
Sorry, how should I create the sequence? If Cayenne increments the value in blocks f 20? nobu On 28 July 2016 at 19:58, John Huss wrote: > By default cayenne expects the sequence to be incremented in blocks of 20, > not by 1, so you have to specify that when you create the sequence. Using > s

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
It seems "last_value" of "pk_asset" is not updated as expected. It gets incremented only once even if I create 3 asset records using Cayenne. It ends up violating asset_PKC constraint. The SQL is like following. create table "asset" ( "asset_id" bigserial not null , "name" character varying

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread John Huss
By default cayenne expects the sequence to be incremented in blocks of 20, not by 1, so you have to specify that when you create the sequence. Using serial columns is very very small improvement and since support is still a ways off you would be much better off just creating your sequences and let

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
If I do not create "pk_asset" sequence, Cayenne 4 throws an Exception saying it requires it. If I create "pk_asset" and let Cayenne 4 assigns the PK using "pk_asset", it looks working fine at a glance, but pk_asset's last_value gets out of sync, the next time we launch the program. nobu On 28 Jul

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Michael Gentry
What do you mean by "out of sync"? Does it generate duplicate PKs? How did you create your sequence? (Can you show us the SQL for it?) Thanks, mrg On Thu, Jul 28, 2016 at 11:10 AM, Harunobu Oyama wrote: > If I do not create "pk_asset" sequence, Cayenne 4 throws an Exception > saying it re

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Hugi Thordarson
This is awesome news :) - hugi > On 28. júl. 2016, at 14:11, Andrus Adamchik wrote: > > Good to know this is finally supported on PG :) > > And yeah, we'll still need to patch Cayenne, so we'll also address PG driver > specifics. > > Andrus > >> On Jul 28, 2016, at 5:01 PM, Michael Gentr

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Michael Gentry
Well, you can still use PostgreSQL's sequences. After all, that's what the "serial" type inherently uses. No need to manually set the PKs. mrg On Thu, Jul 28, 2016 at 10:15 AM, Harunobu Oyama wrote: > Thank you Andrus and Michael, > > I will workaround the issue, probably by explicitly setti

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
Thank you Andrus and Michael, I will workaround the issue, probably by explicitly setting the PK's from Java code, until it gets officially supported by Cayenne then. nbou On 28 July 2016 at 15:11, Andrus Adamchik wrote: > Good to know this is finally supported on PG :) > > And yeah, we'll s

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Andrus Adamchik
Good to know this is finally supported on PG :) And yeah, we'll still need to patch Cayenne, so we'll also address PG driver specifics. Andrus > On Jul 28, 2016, at 5:01 PM, Michael Gentry wrote: > > A little Google searching found: > > https://github.com/pgjdbc/pgjdbc/issues/99 > > This le

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Michael Gentry
A little Google searching found: https://github.com/pgjdbc/pgjdbc/issues/99 This leads me to believe BatchAction.runAsIndividualQueries() would have to be changed for PostgreSQL, otherwise all of the column values are returned instead of just the new PK value. mrg On Thu, Jul 28, 2016 at 9:45

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Michael Gentry
The PostgreSQL documentation says: CREATE TABLE tablename ( colname SERIAL ); is equivalent to specifying: CREATE SEQUENCE tablename_colname_seq; CREATE TABLE tablename ( colname integer NOT NULL DEFAULT nextval('tablename_colname_seq') ); ALTER SEQUENCE tablename_colname_seq OWNED BY ta

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
thanks Andrus! nobu On 28 July 2016 at 14:10, Andrus Adamchik wrote: > Back in the day PG driver did not support autoincremented values at the > JDBC level. So we had to always revert to sequences. > > I'd like to run a test to see if it does now. If the test is successful, > we can reconfigur

Re: auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Andrus Adamchik
Back in the day PG driver did not support autoincremented values at the JDBC level. So we had to always revert to sequences. I'd like to run a test to see if it does now. If the test is successful, we can reconfigure Cayenne PostgresAdapter to enable aoto-increment strategy. Will keep the list

Re: Multiple relationships from inheritance tree

2016-07-28 Thread Andrus Adamchik
Yeah, this should be fine. > On Jul 28, 2016, at 3:55 PM, Ken Anderson wrote: > > Andrus, > > What’s the correct version of the relationship? I’m happy to do it manually > as opposed to syncing it. Should we just have a relationship to the base > class? > > Ken > > Ken Anderson > CTO Am

Re: Multiple relationships from inheritance tree

2016-07-28 Thread Ken Anderson
Andrus, What’s the correct version of the relationship? I’m happy to do it manually as opposed to syncing it. Should we just have a relationship to the base class? Ken Ken Anderson CTO Amphora, Inc. Mobile: +1 914 262 8540 www.amphorainc.com On 7/27/16, 3

Re: Conversion error:

2016-07-28 Thread Andrus Adamchik
A timestamp value should not be read via 'org.apache.cayenne.access.types.ByteArrayType'. Is it actually a timestamp on the Java end? Andrus > On Jul 12, 2016, at 1:56 AM, Tony Giaccone wrote: > > I'm using the H2 database and have a field that's a timestamp, > > > I get this message on try

Re: Reverse engineering and dates

2016-07-28 Thread Andrus Adamchik
Needs to be implemented. But we have the right place for it. Andrus > On Jul 13, 2016, at 12:42 AM, Gmail wrote: > > Does that mean it's possible now but undocumented or that the capability > needs to be implemented using these new features? > > Tony Giaccone > >> On Jun 27, 2016, at 11:41

Re: Extended class issues

2016-07-28 Thread Andrus Adamchik
Would you mind posting a relevant part of your DataMap XML? Andrus > On Jul 13, 2016, at 8:40 PM, Dougan Stuart wrote: > > I have a class Company with a one-to-many relationship to other Companies > (parentCompany <- subCompanies). I’m able to set a Company’s parent when > creating one, but u

auto PK generation in Cayenne 4 + PostgreSQL combination?

2016-07-28 Thread Harunobu Oyama
Hi, What is the proper way to setup auto PK generation when Cayenne 4 + PostgreSQL are in use? Suppose I have a simple table like this. create table "asset" ( "asset_id" bigserial not null , "name" character varying not null , constraint "asset_PKC" primary key ("asset_id") ) ; No matter