-->
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.  [ 2 posts ] 
Author Message
 Post subject: Unkown column SQL Error: 1054, SQLState: 42S22
PostPosted: Fri Jan 21, 2005 4:01 pm 
Newbie

Joined: Fri Jan 21, 2005 3:50 pm
Posts: 2
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

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

<class name="ImageProfile" table="ne_iso_cd_images" proxy="ImageProfile">
<id name="imageID" column="IMAGE_ID" type="long">
<generator class="native"/>
</id>
<property name="imageSource" column="IMAGE_SOURCE"/>
<property name="multiDisk" type="boolean" column="MULTI_DISK"/>
<property name="imageType" column="IMAGE_TYPE"/>
<property name="imageScope" column="IMAGE_SCOPE"/>
<property name="isoCDImageFileName" column="IMAGE_FILE_NAME"/>
<property name="imageFileWithPathOnClient" column="IMAGE_FILE_WITH_PATH_ON_CLIENT"/>
<property name="imageFilePathOnServer" column="IMAGE_FILE_WITH_PATH_ON_SERVER"/>
<property name="imageDescription" column="IMAGE_DESCRIPTION"/>
<property name="imageFormat" column="IMAGE_FORMAT"/>
<property name="imageCreator" column="IMAGE_CREATOR"/>
<property name="imageDateTime" column="UNIQUE_DATETIME_NUMBER"/>
<property name="imageSize" column="IMAGE_SIZE"/>
<property name="resend" type="boolean" column="IMAGE_RESENT"/>
<property name="status" column="STATUS"/>
</class>

</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

System.out.println("Opening Session...");

Session s = factory.openSession();
System.out.println("Session opened successfully");
ImageProfile imageProfile = new ImageProfile();
imageProfile.setImageSource("FILE");
imageProfile.setMultiDisk(true);
imageProfile.setImageType("W2K");
imageProfile.setImageScope("GLOBAL");
imageProfile.setIsoCDImageFileName("ATT-IP phone - Link Sys.iso");
imageProfile.setImageFileWithPathOnClient("D:\\TEMP\\imagefiles\\ATT-IP phone - Link Sys.iso");
//imageProfile.setImageFilePathOnServer(rs.getString("IMAGE_FILE_WITH_PATH_ON_SERVER"));
imageProfile.setImageDescription("");
imageProfile.setImageFormat("");
imageProfile.setImageCreator("ABC, XYZ");
java.util.Date date = new java.util.Date();
imageProfile.setImageDateTime(date.getTime());
//imageProfile.setImageSize(rs.getLong("IMAGE_SIZE"));
imageProfile.setStatus("INCOMPLETE");
imageProfile.setResend(false);
System.out.println("Saving imageProfile..." + imageProfile);
s.save(imageProfile);
System.out.println("imageProfile saved successfully");
s.flush();
s.connection().commit();
List list = s.find("from ImageProfile as profile");
Iterator it = list.iterator();
while(it.hasNext()){
System.out.println((ImageProfile)it.next());

}
s.close();


/////////////
OBJECT
package org.hibernate.hibernate;
/*
* Created on Dec 14, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.io.Serializable;


public class ImageProfile implements Serializable{

public static final String FROM_FILE = "FILE";
public static final String FROM_CD = "CD";
public static final String COMPLETED = "COMPLETED";
public static final String IN_COMPLETE = "INCOMPLETE";
public static final String MOUNTED = "MOUNTED";
public static final String UN_MOUNTED = "UNMOUNTED";

private String imageSource = "";
private boolean multiDisk = false;
private String imageType = "";
private String imageScope = "";
private String isoCDImageFileName = "";
private String imageFileWithPathOnClient = "";
private String imageDescription = "";
private String imageFormat = "";
private long imageID = 0;
private String imageCreator = "";
private long imageDateTime = 0;
private long imageSize = 0;
private boolean resend = false;

//USED ONLY @ SERVER SIDE
private String status = "";
private String imageFilePathOnServer = "";

public ImageProfile(){

}//ImageProfile

/**
* @return Returns the description.
*/
public String getImageDescription() {
return imageDescription;
}
/**
* @param description The description to set.
*/
public void setImageDescription(String description) {
this.imageDescription = description.trim();
}
/**
* @return Returns the imageCreator.
*/
public String getImageCreator() {
return imageCreator;
}
/**
* @param imageCreator The imageCreator to set.
*/
public void setImageCreator(String imageCreator) {
this.imageCreator = imageCreator.trim();
}
/**
* @return Returns the imageDateTime.
*/
public long getImageDateTime() {
return imageDateTime;
}
/**
* @param imageDateTime The imageDateTime to set.
*/
public void setImageDateTime(long imageDate) {
this.imageDateTime = imageDate;
}
/**
* @return Returns the imageFormat.
*/
public String getImageFormat() {
return imageFormat.trim();
}
/**
* @param imageFormat The imageFormat to set.
*/
public void setImageFormat(String imageFormat) {
this.imageFormat = imageFormat;
}
/**
* @return Returns the imageID.
*/
public long getImageID() {
return imageID;
}
/**
* @param imageID The imageID to set.
*/
public void setImageID(long imageID) {
this.imageID = imageID;
}
/**
* @return Returns the imageScope.
*/
public String getImageScope() {
return imageScope.trim();
}
/**
* @param imageScope The imageScope to set.
*/
public void setImageScope(String imageScope) {
this.imageScope = imageScope;
}
/**
* @return Returns the imageSize.
*/
public long getImageSize() {
return imageSize;
}
/**
* @param imageSize The imageSize to set.
*/
public void setImageSize(long imageSize) {
this.imageSize = imageSize;
}
/**
* @return Returns the imageType.
*/
public String getImageType() {
return imageType;
}
/**
* @param imageType The imageType to set.
*/
public void setImageType(String imageType) {
this.imageType = imageType.trim();
}
/**
* @return Returns the isoCDImageFileName.
*/
public String getIsoCDImageFileName() {
return isoCDImageFileName;
}
/**
* @param isoCDImageFileName The isoCDImageFileName to set.
*/
public void setIsoCDImageFileName(String isoCDImageFileName) {
this.isoCDImageFileName = isoCDImageFileName.trim();
}

/**
* @return Returns the imageFilePathOnServer.
*/
public String getImageFilePathOnServer() {
return imageFilePathOnServer;
}
/**
* @param imageFilePathOnServer The imageFilePathOnServer to set.
*/
public void setImageFilePathOnServer(String imageFilePathOnServer) {
this.imageFilePathOnServer = imageFilePathOnServer;
}

/**
* @return Returns the multiDisk.
*/
public boolean isMultiDisk() {
return multiDisk;
}
/**
* @param multiDisk The multiDisk to set.
*/
public void setMultiDisk(boolean isMultiDisk) {
this.multiDisk = isMultiDisk;
}
/**
* @return Returns the localIsoCDImageFilePath.
*/
public String getImageFileWithPathOnClient() {
return imageFileWithPathOnClient;
}
/**
* @param localIsoCDImageFilePath The localIsoCDImageFilePath to set.
*/
public void setImageFileWithPathOnClient(String localIsoCDImageFilePath) {
this.imageFileWithPathOnClient = localIsoCDImageFilePath.trim();
}
/**
* @return Returns the imageSource.
*/
public String getImageSource() {
return imageSource;
}
/**
* @param imageSource The imageSource to set.
*/
public void setImageSource(String imageSource) {
this.imageSource = imageSource.trim();
}

/**
* @return Returns the status.
*/
public String getStatus() {
return status;
}
/**
* @param status The status to set.
*/
public void setStatus(String status) {
this.status = status.trim();
}

/**
* @return Returns the resend.
*/
public boolean isResend() {
return resend;
}
/**
* @param resend The resend to set.
*/
public void setResend(boolean isResend) {
this.resend = isResend;
}
/**
Returns the object in string form.
@return Returns the String representing the object.
*/
public String toString(){
return "ImageSource :" + getImageSource() +
", MultiDisk :" + isMultiDisk() +
", ImageType :" + getImageType() +
", ImageScope :" + getImageScope() +
", ImageFileWithPathOnClient :" + getImageFileWithPathOnClient() +
", ImageFileWithPathOnServer :" + getImageFilePathOnServer() +
", IsoCDImageFileName :" + getIsoCDImageFileName() +
", Description :" + getImageDescription() +
", ImageFormat :" + getImageFormat() +
", ImageID :" + getImageID() +
", ImageCreator :" + getImageCreator() +
", ImageDate :" + getImageDateTime() +
", ImageSize :" + getImageSize() +
", Status :" + getStatus() +
", IsResend :" + isResend();

}
}//ImageProfile



Full stack trace of any exception that occurs:




Hibernate: select imageprofi0_.imag_e_id as imag_e_id, imageprofi0_.imag_e_sourc
e as imag_e_s2_, imageprofi0_.mult_i_disk as mult_i_d3_, imageprofi0_.imag_e_typ
e as imag_e_t4_, imageprofi0_.imag_e_scope as imag_e_s5_, imageprofi0_.imag_e_fi
l_e_name as imag_e_f6_, imageprofi0_.imag_e_fil_e_wit_h_pat_h_o_n_client as imag
_e_f7_, imageprofi0_.imag_e_fil_e_wit_h_pat_h_o_n_server as imag_e_f8_, imagepro
fi0_.imag_e_description as imag_e_d9_, imageprofi0_.imag_e_format as imag_e_10_,
imageprofi0_.imag_e_creator as imag_e_11_, imageprofi0_.uniqu_e_datetim_e_numbe
r as uniqu_e12_, imageprofi0_.imag_e_size as imag_e_13_, imageprofi0_.imag_e_res
ent as imag_e_14_, imageprofi0_.status as status from ne_iso_cd_images imageprof
i0_
Jan 21, 2005 12:59:40 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
WARNING: SQL Error: 1054, SQLState: 42S22
Jan 21, 2005 12:59:40 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
SEVERE: Unknown column 'imageprofi0_.imag_e_id' in 'field list'
Jan 21, 2005 12:59:40 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
WARNING: SQL Error: 1054, SQLState: 42S22
Jan 21, 2005 12:59:40 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
SEVERE: Unknown column 'imageprofi0_.imag_e_id' in 'field list'
net.sf.hibernate.exception.SQLGrammarException: Could not execute query
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConver
ter.java:69)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionH
elper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.netenrich.model.query.ISOCDImageQuery.list(Unknown Source)
at com.netenrich.persist.hibernate.HibernatePersistSession.find(Unknown
Source)
at com.netenrich.service.SessionContext.find(Unknown Source)
at com.netenrich.service.impl.LocalISOCDImageManagementService.getAllIma
ges(Unknown Source)
at org.apache.jsp.jsp.devices.ISOCDImages_jsp._jspService(org.apache.jsp
.jsp.devices.ISOCDImages_jsp:187)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
95)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:674)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:465)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:400)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:303)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.
java:1056)
at org.apache.struts.action.RequestProcessor.processForwardConfig(Reques
tProcessor.java:388)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:231)
at com.netenrich.web.common.NERRequestProcessor.process(Unknown Source)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
4)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at com.netenrich.web.login.AuthenticationFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
526)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Unknown column 'imageprofi0_.imag_e_id' in 'fi
eld list'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
1586)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(
DelegatingPreparedStatement.java:92)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:88)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
... 44 more



Name and version of the database you are using:
MySQL 4.1

The generated SQL (show_sql=true):
Hibernate: select imageprofi0_.imag_e_id as imag_e_id, imageprofi0_.imag_e_sourc
e as imag_e_s2_, imageprofi0_.mult_i_disk as mult_i_d3_, imageprofi0_.imag_e_typ
e as imag_e_t4_, imageprofi0_.imag_e_scope as imag_e_s5_, imageprofi0_.imag_e_fi
l_e_name as imag_e_f6_, imageprofi0_.imag_e_fil_e_wit_h_pat_h_o_n_client as imag
_e_f7_, imageprofi0_.imag_e_fil_e_wit_h_pat_h_o_n_server as imag_e_f8_, imagepro
fi0_.imag_e_description as imag_e_d9_, imageprofi0_.imag_e_format as imag_e_10_,
imageprofi0_.imag_e_creator as imag_e_11_, imageprofi0_.uniqu_e_datetim_e_numbe
r as uniqu_e12_, imageprofi0_.imag_e_size as imag_e_13_, imageprofi0_.imag_e_res
ent as imag_e_14_, imageprofi0_.status as status from ne_iso_cd_images imageprof
i0_

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 8:03 pm 
Newbie

Joined: Fri Jan 21, 2005 3:50 pm
Posts: 2
I found the problem.... Earlier we used the DefaultNamingStrategy and when we switched from DefaultNamingStrategy to ImprovedNamingStrategy. I have converted column names to lower case. that will solve my problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.