db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: [jira] Updated: (JDO-308) Remove attribute strategy from elements datastore-identity in ORM files
Date Tue, 28 Feb 2006 21:30:27 GMT
Hi,

On Feb 28, 2006, at 9:40 AM, erik@jpox.org wrote:

> [ReSEnDING lost in some wire...]
>
> I'm working on the action item, and I have one question about it.  
> JPOX will
> have
> to validate primary key columns, and one of the primary key fields  
> is String.
> The column for the primary key in the db has 16 chars length, but  
> in the
> metadata it defaults to 255 (JPOX). Spec says it should defaults to  
> 256.
>
> 1-what should the impl do: take the schema from db as valid or the  
> metadata?

If you're generating schema, then you should figure out what the  
length should be from the column metadata. If you already have a  
database, you should not use the length or scale settings (default or  
not) but use the column definition in the database.
>
> 2-The most common limit for CHAR in RDBMS is 255, why is it set to  
> 256 in the
> spec?

Somewhat random. Some products I looked at on the web default to 254,  
some to 255, and some to 1. If you think that a more rational default  
for your users is 255, then you can set up a property (e.g.  
org.jpox.generate.defaultLength=255) when doing schema generation and  
this would override the JDO default setting.

Craig
>
>> Quoting "Michael Watzek (JIRA)" <jira@apache.org>:
>>
>>>      [ http://issues.apache.org/jira/browse/JDO-308?page=all ]
>>>
>>> Michael Watzek updated JDO-308:
>>> -------------------------------
>>>
>>>     Attachment: JDO-308.patch
>>>
>>> The attached patch fixes this issue. Applying this patch, a TCK  
>>> run results
>>> in 4 failures and 409 errors. Most of the errors are due to the same
>> problem:
>>> JPOX generates SQL which inserts a value into an identity column  
>>> (see
>> below).
>>> Eric has an action item to investigate JPOX's ability to use native
>> identity
>>> strategy given an identity column in the schema (see minutes Feb  
>>> 17 2006).
>>>
>>> 133)
>>>
>> testPositive(org.apache.jdo.tck.query.sql.NewQuery) 
>> javax.jdo.JDOUserException:
>>> One or more instances could not be made persistent
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.makePersistentAll 
> (AbstractPersistenceManager.java:1217)
>>> 	at
>> org.apache.jdo.tck.query.QueryTest.makePersistentAll 
>> (QueryTest.java:225)
>>> 	at
>>>
>>
> org.apache.jdo.tck.query.QueryTest.loadAndPersistCompanyModel 
> (QueryTest.java:201)
>>> 	at org.apache.jdo.tck.query.sql.NewQuery.localSetUp 
>>> (NewQuery.java:87)
>>> 	at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:187)
>>> 	at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:203)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.start 
>>> (BatchTestRunner.java:120)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.main 
>>> (BatchTestRunner.java:95)
>>> NestedThrowablesStackTrace:
>>> javax.jdo.JDODataStoreException: Insert request failed: INSERT INTO
>>> datastoreidentity0.COMPANIES
>>>
>>
> (DATASTORE_IDENTITY,ID,FOUNDEDDATE,"NAME",ADDRID,CITY,COUNTRY,"STATE", 
> STREET,ZIPCODE)
>>> VALUES (?,?,?,?,?,?,?,?,?,?)
>>> 	at
>>> org.jpox.store.rdbms.request.InsertRequest.execute 
>>> (InsertRequest.java:338)
>>> 	at org.jpox.store.rdbms.table.ClassTable.insert(ClassTable.java: 
>>> 2110)
>>> 	at org.jpox.store.StoreManager.insert(StoreManager.java:735)
>>> 	at
>>>
>>
> org.jpox.state.StateManagerImpl.internalMakePersistent 
> (StateManagerImpl.java:3310)
>>> 	at
>>> org.jpox.state.StateManagerImpl.makePersistent 
>>> (StateManagerImpl.java:3283)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.internalMakePersistent 
> (AbstractPersistenceManager.java:1112)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.makePersistent 
> (AbstractPersistenceManager.java:1167)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.makePersistentAll 
> (AbstractPersistenceManager.java:1207)
>>> 	at
>> org.apache.jdo.tck.query.QueryTest.makePersistentAll 
>> (QueryTest.java:225)
>>> 	at
>>>
>>
> org.apache.jdo.tck.query.QueryTest.loadAndPersistCompanyModel 
> (QueryTest.java:201)
>>> 	at org.apache.jdo.tck.query.sql.NewQuery.localSetUp 
>>> (NewQuery.java:87)
>>> 	at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:187)
>>> 	at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:203)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.start 
>>> (BatchTestRunner.java:120)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.main 
>>> (BatchTestRunner.java:95)
>>> NestedThrowablesStackTrace:
>>> ERROR 42Z23: Attempt to modify an identity column  
>>> 'DATASTORE_IDENTITY'.
>>> 	at org.apache.derby.iapi.error.StandardException.newException 
>>> (Unknown
>>> Source)
>>> 	at
>>>
>> org.apache.derby.impl.sql.compile.ResultColumnList.checkAutoincrement 
>> (Unknown
>>> Source)
>>> 	at org.apache.derby.impl.sql.compile.InsertNode.bind(Unknown  
>>> Source)
>>> 	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown  
>>> Source)
>>> 	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown  
>>> Source)
>>> 	at
>>>
>>
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepar 
> eInternalStatement(Unknown
>>> Source)
>>> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown
>> Source)
>>> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init> 
>>> (Unknown
>>> Source)
>>> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init> 
>>> (Unknown
>>> Source)
>>> 	at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown
>> Source)
>>> 	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement 
>>> (Unknown
>>> Source)
>>> 	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement 
>>> (Unknown
>>> Source)
>>> 	at
>>>
>>
> com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement 
> (NewProxyConnection.java:190)
>>> 	at org.jpox.store.rdbms.RDBMSManager.getStatement 
>>> (RDBMSManager.java:359)
>>> 	at org.jpox.store.rdbms.RDBMSManager.getStatement 
>>> (RDBMSManager.java:316)
>>> 	at
>>> org.jpox.store.rdbms.request.InsertRequest.execute 
>>> (InsertRequest.java:181)
>>> 	at org.jpox.store.rdbms.table.ClassTable.insert(ClassTable.java: 
>>> 2110)
>>> 	at org.jpox.store.StoreManager.insert(StoreManager.java:735)
>>> 	at
>>>
>>
> org.jpox.state.StateManagerImpl.internalMakePersistent 
> (StateManagerImpl.java:3310)
>>> 	at
>>> org.jpox.state.StateManagerImpl.makePersistent 
>>> (StateManagerImpl.java:3283)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.internalMakePersistent 
> (AbstractPersistenceManager.java:1112)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.makePersistent 
> (AbstractPersistenceManager.java:1167)
>>> 	at
>>>
>>
> org.jpox.AbstractPersistenceManager.makePersistentAll 
> (AbstractPersistenceManager.java:1207)
>>> 	at
>> org.apache.jdo.tck.query.QueryTest.makePersistentAll 
>> (QueryTest.java:225)
>>> 	at
>>>
>>
> org.apache.jdo.tck.query.QueryTest.loadAndPersistCompanyModel 
> (QueryTest.java:201)
>>> 	at org.apache.jdo.tck.query.sql.NewQuery.localSetUp 
>>> (NewQuery.java:87)
>>> 	at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:187)
>>> 	at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:203)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.start 
>>> (BatchTestRunner.java:120)
>>> 	at org.apache.jdo.tck.util.BatchTestRunner.main 
>>> (BatchTestRunner.java:95)
>>>
>>>
>>>> Remove attribute strategy from elements datastore-identity in  
>>>> ORM files
>>>> ------------------------------------------------------------------- 
>>>> ----
>>>>
>>>>          Key: JDO-308
>>>>          URL: http://issues.apache.org/jira/browse/JDO-308
>>>>      Project: JDO
>>>>         Type: Bug
>>>>   Components: tck20
>>>>     Versions: JDO 2 beta
>>>>     Reporter: Michael Watzek
>>>>     Assignee: Michael Watzek
>>>>     Priority: Minor
>>>>      Fix For: JDO 2 final
>>>>  Attachments: JDO-308.patch
>>>>
>>>> We decided to remove attribute strategy rom elements datastore- 
>>>> identity
>> in
>>> ORM files. Thus, default strategy "native" will apply. The  
>>> rationale is to
>>> also support JDO implementations, which only support datastore  
>>> identity and
>>> which only runs on a RDBMS that has sequences and no identity  
>>> columns.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> -
>>> If you think it was sent incorrectly contact one of the  
>>> administrators:
>>>    http://issues.apache.org/jira/secure/Administrators.jspa
>>> -
>>> For more information on JIRA, see:
>>>    http://www.atlassian.com/software/jira
>>>
>>>
>>
>>
>>
>
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message