-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Exception - invalid column name 'class'
PostPosted: Tue Oct 28, 2003 2:01 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I trying to get Hibernate to work, but I get this one (on Sybase). I says I have a column name 'class', but I don't. The schema doesn't have it, nor does the mapping / source files.

Weird?


WARNING: SQL Error: 207, SQLState: ZZZZZ
28.okt.2003 18:56:03 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Invalid column name 'class'.
28.okt.2003 18:56:03 net.sf.hibernate.JDBCException <init>
SEVERE: could not insert: [Person#506]
com.sybase.jdbc2.jdbc.SybSQLException: Invalid column name 'class'.
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2535)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1916)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:201)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:182)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1540)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1523)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:89)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:518)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:493)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2313)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2267)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2211)
at Test.main(Test.java:43)
28.okt.2003 18:56:03 net.sf.hibernate.impl.SessionImpl execute
SEVERE: Could not synchronize database state with session


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You are attempting to use some subclassing in your Hibernate mappings and have not properly set up the discriminator element on one or more of the subclasses. Specifically, you have left off the "column" attribute, which defaults to class.

All in the docs...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:23 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Ahh. Not easy for a newbie, because I guess I believed the column was automatically generated by SchemaExport.

How do I specify in the mapping doc that the SchemaExport should create a column for the descriminator???

I never touch the database manually - everything must be generated by SchemaExport.

Example please :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:24 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
...because I assume it is not the meaning that I have to add a <property> for the discriminator column???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
No, you need to add a <discriminator> element not a <property> element.

http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s1-5


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:44 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
but I have done that, I used all default values so it's an empty discriminator tag.

Why isn't the class column generated???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 2:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Sorry, I do not use the schema generation tools, so I really cannot say. Sounds like it may not be honoring the DTD default value for that attribute.

Explicitly set it and see what happens.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2003 3:29 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
thank, it works.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.