You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by jmp5167 <jm...@gmail.com> on 2010/02/02 22:20:04 UTC

Class is not mapped

Hello,

I am new to using Cayenne so I decided to first start by going through the
tutorial.  All went fine until I tried to build my project.  I get an error
that says:

Exception in thread "main" java.lang.IllegalArgumentException: Class is not
mapped with Cayenne: org.example.cayenne.persistent.Artist at
org.apache.cayenne.access.DataContext.newObject(DataContext.java:689)at
org.example.cayenne.persistent.Main.main(Main.java:11)

I guess I'm looking for a reason why my classes are not mapped with cayenne.

Thank you in advance
-- 
View this message in context: http://n3.nabble.com/Class-is-not-mapped-tp183513p183513.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Class is not mapped

Posted by Michael Gentry <mg...@masslight.net>.
The AUTO_PK_SUPPORT table is used (and created) by Cayenne to generate
primary keys.  When you create your DB schema in Cayenne Modeler it
can automatically create that table for you (this is the "Create
Primary Key Support" checkbox option).  The easiest thing to do,
probably, is use Cayenne Modeler to generate that table for you (only
select the "Create Primary Key Support" option so you don't overwrite
other tables/etc).

mrg


On Wed, Feb 3, 2010 at 10:00 AM, jmp5167 <jm...@gmail.com> wrote:
>
>
> Andrey Razumovsky wrote:
>>
>> commit exception always has its cause, so you need to investigate (and
>> post
>> here if needed) bottom stack trace of the exception
>>
>> 2010/2/3 jmp5167 <jm...@gmail.com>
>>
>>>
>>> Thanks for you reply.  I think I have fixed my initial problem, there was
>>> a
>>> problem with the cayenne.xml file.  But now I am having trouble with my
>>> context.commitChanges() line.  I am getting this error:
>>>
>>> Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
>>> [v.3.0RC1 Jan 05 2010 14:44:59] Commit Exception
>>>        at
>>> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>>>        at
>>> org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>>>        at org.example.cayenne.persistent.Main.main(Main.java:30)
>>>
>>> which doesnt make much sense to me except that I understand that
>>> commitChanges actually sends the data to the database to be saved.
>>> Otherwise I'm lost.
>>> --
>>> View this message in context:
>>> http://n3.nabble.com/Class-is-not-mapped-tp183513p184666.html
>>> Sent from the Cayenne - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Andrey
>>
>>
>
>
> By bottom stack trace do you mean this:
>
> aused by: java.sql.SQLSyntaxErrorException: Table/View 'AUTO_PK_SUPPORT'
> does not exist.
>        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.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.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown
> Source)
>        at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
>        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
> Source)
>        at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
> Source)
>        at
> org.apache.cayenne.conn.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:296)
>        at
> org.apache.cayenne.conn.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:302)
>        at
> org.apache.cayenne.access.TransactionConnectionDecorator.prepareStatement(TransactionConnectionDecorator.java:167)
>        at
> org.apache.cayenne.dba.derby.DerbyPkGenerator.longPkFromDatabase(DerbyPkGenerator.java:69)
>        at
> org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:270)
>        at
> org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:165)
>        at
> org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:76)
>        at
> org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:79)
>        at
> org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:182)
>        at
> org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:134)
>        at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
>        at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
>        at
> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
>        at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
>        at
> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1106)
>        ... 2 more
> Caused by: java.sql.SQLException: Table/View 'AUTO_PK_SUPPORT' does not
> exist.
>        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
>        at
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
> Source)
>        ... 30 more
> Caused by: ERROR 42X05: Table/View 'AUTO_PK_SUPPORT' does not exist.
>        at org.apache.derby.iapi.error.StandardException.newException(Unknown
> Source)
>        at
> org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown
> Source)
>        at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown
> Source)
>        at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
>        at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown
> Source)
>        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown
> Source)
>        at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
>        at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(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.prepareInternalStatement(Unknown
> Source)
>        ... 24 more
>
>
> because I was looking at this but the only thing I recognize is that it says
> AUTO_PK_SUPPORT does not exist.  I have primary keys set but I dont know
> what the rest of it means
> --
> View this message in context: http://n3.nabble.com/Class-is-not-mapped-tp183513p184713.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>

Re: Class is not mapped

Posted by jmp5167 <jm...@gmail.com>.

Andrey Razumovsky wrote:
> 
> commit exception always has its cause, so you need to investigate (and
> post
> here if needed) bottom stack trace of the exception
> 
> 2010/2/3 jmp5167 <jm...@gmail.com>
> 
>>
>> Thanks for you reply.  I think I have fixed my initial problem, there was
>> a
>> problem with the cayenne.xml file.  But now I am having trouble with my
>> context.commitChanges() line.  I am getting this error:
>>
>> Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
>> [v.3.0RC1 Jan 05 2010 14:44:59] Commit Exception
>>        at
>> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>>        at
>> org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>>        at org.example.cayenne.persistent.Main.main(Main.java:30)
>>
>> which doesnt make much sense to me except that I understand that
>> commitChanges actually sends the data to the database to be saved.
>> Otherwise I'm lost.
>> --
>> View this message in context:
>> http://n3.nabble.com/Class-is-not-mapped-tp183513p184666.html
>> Sent from the Cayenne - User mailing list archive at Nabble.com.
>>
> 
> 
> 
> -- 
> Andrey
> 
> 


By bottom stack trace do you mean this:

aused by: java.sql.SQLSyntaxErrorException: Table/View 'AUTO_PK_SUPPORT'
does not exist.
	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.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.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown
Source)
	at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown
Source)
	at
org.apache.cayenne.conn.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:296)
	at
org.apache.cayenne.conn.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:302)
	at
org.apache.cayenne.access.TransactionConnectionDecorator.prepareStatement(TransactionConnectionDecorator.java:167)
	at
org.apache.cayenne.dba.derby.DerbyPkGenerator.longPkFromDatabase(DerbyPkGenerator.java:69)
	at
org.apache.cayenne.dba.JdbcPkGenerator.generatePk(JdbcPkGenerator.java:270)
	at
org.apache.cayenne.access.DataDomainInsertBucket.createPermIds(DataDomainInsertBucket.java:165)
	at
org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal(DataDomainInsertBucket.java:76)
	at
org.apache.cayenne.access.DataDomainSyncBucket.appendQueries(DataDomainSyncBucket.java:79)
	at
org.apache.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:182)
	at
org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:134)
	at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
	at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
	at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
	at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
	at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1106)
	... 2 more
Caused by: java.sql.SQLException: Table/View 'AUTO_PK_SUPPORT' does not
exist.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
	at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
	... 30 more
Caused by: ERROR 42X05: Table/View 'AUTO_PK_SUPPORT' does not exist.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
	at
org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown
Source)
	at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown
Source)
	at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
	at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown
Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown
Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(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.prepareInternalStatement(Unknown
Source)
	... 24 more


because I was looking at this but the only thing I recognize is that it says
AUTO_PK_SUPPORT does not exist.  I have primary keys set but I dont know
what the rest of it means
-- 
View this message in context: http://n3.nabble.com/Class-is-not-mapped-tp183513p184713.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Class is not mapped

Posted by Andrey Razumovsky <ra...@gmail.com>.
commit exception always has its cause, so you need to investigate (and post
here if needed) bottom stack trace of the exception

2010/2/3 jmp5167 <jm...@gmail.com>

>
> Thanks for you reply.  I think I have fixed my initial problem, there was a
> problem with the cayenne.xml file.  But now I am having trouble with my
> context.commitChanges() line.  I am getting this error:
>
> Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
> [v.3.0RC1 Jan 05 2010 14:44:59] Commit Exception
>        at
> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
>        at
> org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
>        at org.example.cayenne.persistent.Main.main(Main.java:30)
>
> which doesnt make much sense to me except that I understand that
> commitChanges actually sends the data to the database to be saved.
> Otherwise I'm lost.
> --
> View this message in context:
> http://n3.nabble.com/Class-is-not-mapped-tp183513p184666.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>



-- 
Andrey

Re: Class is not mapped

Posted by jmp5167 <jm...@gmail.com>.
Thanks for you reply.  I think I have fixed my initial problem, there was a
problem with the cayenne.xml file.  But now I am having trouble with my
context.commitChanges() line.  I am getting this error:

Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
[v.3.0RC1 Jan 05 2010 14:44:59] Commit Exception
	at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1134)
	at
org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
	at org.example.cayenne.persistent.Main.main(Main.java:30)

which doesnt make much sense to me except that I understand that
commitChanges actually sends the data to the database to be saved. 
Otherwise I'm lost.
-- 
View this message in context: http://n3.nabble.com/Class-is-not-mapped-tp183513p184666.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Class is not mapped

Posted by Andrey Razumovsky <ra...@gmail.com>.
Hi,

What version of Cayenne are you trying? To check if everything's mapped
well, open cayenne.xml with Cayenne Modeler, find ObjEntity (green icon)
Artist and make sure that org.example.cayenne.persistent.Artist is specified
as class name. But, if you hadn't changed anything in tutorial project, I'm
not sure why it cold have broken

2010/2/3 jmp5167 <jm...@gmail.com>

>
> Hello,
>
> I am new to using Cayenne so I decided to first start by going through the
> tutorial.  All went fine until I tried to build my project.  I get an error
> that says:
>
> Exception in thread "main" java.lang.IllegalArgumentException: Class is not
> mapped with Cayenne: org.example.cayenne.persistent.Artist at
> org.apache.cayenne.access.DataContext.newObject(DataContext.java:689)at
> org.example.cayenne.persistent.Main.main(Main.java:11)
>
> I guess I'm looking for a reason why my classes are not mapped with
> cayenne.
>
> Thank you in advance
> --
> View this message in context:
> http://n3.nabble.com/Class-is-not-mapped-tp183513p183513.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>



-- 
Andrey