cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Stenlund <tomas.stenl...@telia.com>
Subject Re: CreateIfNoSchemaStrategy not as I expected
Date Tue, 28 Dec 2010 10:11:38 GMT
Thanks Andrus,

I will have to learn to look through the bug-reports before I post 
something. I'll just revert back to no schema update and no quotes for now.

I tried to locate where in cayenne this was happening, but I realise 
after a couple of minutes that it would be a formidable task to get 
inside how that part of cayenne works just by looking at the source for 
a couple of minutes. I frankly don't even know where to start looking 
after some feebly attempts of find and greps.

Cheers,

Tomas

On 12/28/2010 09:53 AM, Andrus Adamchik wrote:
> I think you are seeing this bug:
>
> https://issues.apache.org/jira/browse/CAY-1506
>
> Will need to fix it ASAP.
>
> Andrus
>
> On Dec 28, 2010, at 10:50 AM, Tomas Stenlund wrote:
>
>> Hmm,
>>
>> sorry to bother you guys again, even though that worked it seems that cayenne now
generates the following queries:
>>
>> SELECT "t0"."fkid_competition", "t0"."id_club", "t0"."name" FROM "XCUSER"."ClubDbEntity"
"t0" WHERE t0.fkid_competition = ? [bind: 1-&gt;fkid_competition:200] - prepared in 38
ms.</message>
>>
>> Which fails due to the column in the WHERE clause not to be "quoted" when doing "relationship-query"
on the entity.
>>
>> Cheers,
>>
>> Tomas
>>
>> On 12/27/2010 10:36 PM, Michael Gentry wrote:
>>> Awesome!  :-)
>>>
>>>
>>> On Mon, Dec 27, 2010 at 4:30 PM, Tomas Stenlund
>>> <tomas.stenlund@telia.com>   wrote:
>>>> Hi Michael,
>>>>
>>>> sneaky thing. That did it :-) Never though about that one ...
>>>>
>>>> Thanks,
>>>>
>>>> Tomas
>>>>
>>>> On 12/27/2010 10:23 PM, Michael Gentry wrote:
>>>>> Hi Tomas,
>>>>>
>>>>> What happens if you turn on "Quote SQL Identifiers" under your DataMap?
>>>>>
>>>>> mrg
>>>>>
>>>>>
>>>>> On Mon, Dec 27, 2010 at 4:00 PM, Tomas Stenlund
>>>>> <tomas.stenlund@telia.com>     wrote:
>>>>>> Hi,
>>>>>>
>>>>>> just to make sure I did not overlook something I verified the versions
on
>>>>>> the libs that is required by cayenne (I don't use maven for my project)
>>>>>> but
>>>>>> they seemed to be correct. Then I added some INFO logging in
>>>>>> CreateIfNoSchemaStrategy.java and for what I see the derby database
>>>>>> return
>>>>>> all tablenames with all letters in uppercase, but I use UpperCamelCase
in
>>>>>> the Modeller. So the comparision in CreateIfNoSchemaStrategy between
the
>>>>>> nameTables and the entitites never match in my case giving this effect.
>>>>>>
>>>>>> So, I will add a JIRA.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Tomas
>>>>>>
>>>>>> On 12/27/2010 09:45 AM, Andrus Adamchik wrote:
>>>>>>> So far CreateIfNoSchemaStrategy worked pretty reliably for me.
So very
>>>>>>> odd.. Could you please open a bug report in Jira. We may take
a look.
>>>>>>> (Please also specify version of Derby).
>>>>>>>
>>>>>>> Andrus
>>>>>>>
>>>>>>> On Dec 26, 2010, at 10:43 PM, Tomas Stenlund wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm using Cayenne 3.0 with Derby as an embedded database
and with
>>>>>>>> -Dderby.system.home=/home/tomas/xc/data and I have also selected
>>>>>>>> CreateIfNoSchemaStrategy as my strategy. I was expecting
the database
>>>>>>>> to be
>>>>>>>> created on first access (which also happens), but the second
run it
>>>>>>>> still
>>>>>>>> says no schema detected and tries to create it again with
a lot of
>>>>>>>> exceptions as a result. The derby connection string is
>>>>>>>> "jdbc:derby:xcdb;create=true".
>>>>>>>>
>>>>>>>> Thanks for any pointers into what I might be missing here,
>>>>>>>>
>>>>>>>> Tomas
>>>>>>>>
>>>>>>>> .....
>>>>>>>> Dec 26, 2010 9:29:43 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logPoolCreated
>>>>>>>> INFO: Created connection pool: jdbc:derby:xcdb;create=true
>>>>>>>>   Driver class: org.apache.derby.jdbc.EmbeddedDriver
>>>>>>>>   Min. connections in the pool: 1
>>>>>>>>   Max. connections in the pool: 1
>>>>>>>> Dec 26, 2010 9:29:44 PM org.apache.cayenne.conf.RuntimeLoadDelegate
>>>>>>>> shouldLoadDataNode
>>>>>>>> INFO: loaded datasource.
>>>>>>>> Dec 26, 2010 9:29:44 PM org.apache.cayenne.conf.RuntimeLoadDelegate
>>>>>>>> initAdapter
>>>>>>>> INFO: no adapter set, using automatic adapter.
>>>>>>>> Dec 26, 2010 9:29:44 PM org.apache.cayenne.conf.RuntimeLoadDelegate
>>>>>>>> shouldLinkDataMap
>>>>>>>> INFO: loaded map-ref: XCDomainMap.
>>>>>>>> Dec 26, 2010 9:29:44 PM org.apache.cayenne.conf.RuntimeLoadDelegate
>>>>>>>> finishedLoading
>>>>>>>> INFO: finished configuration loading in 785 ms.
>>>>>>>> Dec 26, 2010 9:29:44 PM cc.stenlund.xc.start.Main<init>
>>>>>>>> INFO: Starting XC
>>>>>>>> Dec 26, 2010 9:29:50 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logQueryStart
>>>>>>>> INFO: --- will run 1 query.
>>>>>>>> Dec 26, 2010 9:29:50 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logConnect
>>>>>>>> INFO: Opening connection: jdbc:derby:xcdb;create=true
>>>>>>>>   Login: xcuser
>>>>>>>>   Password: *******
>>>>>>>> Dec 26, 2010 9:29:52 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logConnectSuccess
>>>>>>>> INFO: +++ Connecting: SUCCESS.
>>>>>>>> Dec 26, 2010 9:29:52 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logBeginTransaction
>>>>>>>> INFO: --- transaction started.
>>>>>>>> Dec 26, 2010 9:29:52 PM org.apache.cayenne.access.QueryLogger
log
>>>>>>>> INFO: Detected and installed adapter:
>>>>>>>> org.apache.cayenne.dba.derby.DerbyAdapter
>>>>>>>> Dec 26, 2010 9:29:52 PM
>>>>>>>> org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy
processSchema
>>>>>>>> Update
>>>>>>>> INFO: No schema detected, will create mapped tables
>>>>>>>> Dec 26, 2010 9:29:52 PM org.apache.cayenne.access.QueryLogger
logQuery
>>>>>>>> INFO: CREATE TABLE xcuser.CompetitionDbEntity (id_competition
INTEGER
>>>>>>>> NOT
>>>>>>>> NULL, location CHAR (80), name CHAR (80) NOT NULL, organizer
CHAR (80),
>>>>>>>> start DATE, PRIMARY KEY (id_compet
>>>>>>>> ition))
>>>>>>>> Dec 26, 2010 9:29:53 PM org.apache.cayenne.access.QueryLogger
>>>>>>>> logQueryError
>>>>>>>> INFO: *** error.
>>>>>>>> java.sql.SQLException: Table/View 'COMPETITIONDBENTITY' already
exists
>>>>>>>> in
>>>>>>>> Schema 'XCUSER'.
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
>>>>>>>> Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
>>>>>>>> Source)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
>>>>>>>> Source)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
>>>>>>>> Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
>>>>>>>> Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
>>>>>>>> Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
>>>>>>>> Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown
Source)
>>>>>>>>   at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown
Source)
>>>>>>>>   at
>>>>>>>> org.apache.cayenne.access.DbGenerator.safeExecute(DbGenerator.java:348)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.access.DbGenerator.runGenerator(DbGenerator.java:292)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy.generate(CreateIfNoSchemaStrategy.java:78)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy.processSchemaUpdate(CreateIfNoSchemaStrategy.java:60)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.access.dbsync.BaseSchemaUpdateStrategy.updateSchema(BaseSchemaUpdateStrategy.java:48)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.access.DataNode$TransactionDataSource.getConnection(DataNode.java:355)
>>>>>>>>   at
>>>>>>>>
>>>>>>>> org.apache.cayenne.conf.NodeDataSource.getConnection(NodeDataSource.java:46)
>>>>>>>>
>>>>>>>> ......
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>
>


Mime
View raw message