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 Mon, 27 Dec 2010 21:00:27 GMT
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