-->
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.  [ 3 posts ] 
Author Message
 Post subject: Insert a field 'TYPE' in query
PostPosted: Wed Feb 08, 2006 5:19 am 
Newbie

Joined: Wed Feb 08, 2006 4:59 am
Posts: 2
Hello,

Every query for a specific table I receive this ERROR:
09:59:07,358 - ERROR: [JDBCExceptionReporter] Unknown column 'TYPE' in 'field list'

When you see the generated SQL, it's with a new columm
columm = TYPE
value = 'com.client.project.core.common.beans.persistent.RtControlPanelItemLogging'


I don't have this field in my class.

Could you help me, please?


Thank you very much
Patrick


Hibernate version:
version 3.1, Dec 12, 2005

Mapping documents:
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<mapping class="com.client.project.core.common.beans.persistent.RtControlPanelItemLogging" />

Full stack trace of any exception that occurs:
org.hibernate.exception.SQLGrammarException: could not insert: [com.fpc.nokeos.core.common.beans.persistent.RtControlPanelItemLogging]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1986)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:544)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:533)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:529)
at com.client.project.core.server.dictionary.DictionaryContext.savePojo(DictionaryContext.java:119)
at com.client.project.component.controlpanel.task.server.business.ControlPanelPluginTaskHelper.saveAReport(ControlPanelPluginTaskHelper.java:75)
at com.client.project.component.controlpanel.task.test.ControlPanelPluginTaskTestCase.testSaveAReport(ControlPanelPluginTaskTestCase.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Unknown column 'TYPE' in 'field list'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1166)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1082)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1067)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1968)
... 32 more

Name and version of the database you are using:
MySQL
version: 4.1.12-nt

The generated SQL (show_sql=true):
Hibernate: insert into rt_control_panel_item_logging (rtcontrolpanelitemid, loggingentryid, fromid, dateadded, comment, TYPE) values (?, ?, ?, ?, ?, 'com.client.client.core.common.beans.persistent.RtControlPanelItemLogging')


Top
 Profile  
 
 Post subject: Re: Insert a field 'TYPE' in query
PostPosted: Wed Feb 08, 2006 6:30 am 
Beginner
Beginner

Joined: Mon Jan 30, 2006 2:28 am
Posts: 47
Location: INDIA
Hi Patrick,
You mentioned the MYSQL4.1.12 nt. Database. Please Try to check the Hibernate Community Supported Databases.

Reference Link Is : http://www.hibernate.org/80.html

My Idea is:
1. Try to change the database version (Hibernate Support Database) or
2. If your DB is correct, Please Check the mapping files (*.hbm.xml files)
and check both Database column name and mapping file (*.hbm.xml)
file column name should be same. Try to mention correct

I have a one table: userlogin
It contains username and password both are string type.
This is looking like.

<hibernate-mapping package="hibernate.loginDB">

<class name="Userlogin" table="userlogin">
<id name="username" column="username" type="string">
<generator class="native"/>
</id>

<property name="password" column="password" type="string" not-null="true" />

</class>
</hibernate-mapping>

Try to correctly enter the package (see above hibernate.loginDB)
and DB Column name and hbm.xml file(above code) column name should be same.

Thanks.All the best.

_________________
A.Edward Durai
"The things which are impossible with men are possible with God."


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 7:00 am 
Newbie

Joined: Wed Feb 08, 2006 4:59 am
Posts: 2
Best Edward Durai,

I'm using a Hibernate Annotations.

So I've just configurated the hibernate.cfg.xml like:

<mapping class="com.client.project.core.common.beans.persistent.RtControlPanelItemLogging" />



All information is in my POJO, like:


/**
* Get the id of this object.
*
* @return the id
*/
@Id(generate = GeneratorType.AUTO)
@Column(name = "rtcontrolpaneltaskstatusid", unique = true, nullable = false, insertable = true, updatable = true, length = 255, precision = 19, scale = 2)
public Integer getRtControlPanelTaskStatusID() {
return this.rtcontrolpaneltaskstatusid;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.