I'm using Eclipse ide Jboss Tool. I had created with the wizard the following file:
EsbCommonlog.hbm.xml <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 26-mag-2010 9.25.48 by Hibernate Tools 3.3.0.GA --> <hibernate-mapping> <class name="model.EsbCommonlog" table="esb_commonlog" catalog="MySql"> <composite-id name="id" class="model.EsbCommonlogId"> <key-property name="timeStamp" type="timestamp"> <column name="TIME_STAMP" length="19" /> </key-property> <key-property name="requestId" type="string"> <column name="REQUEST_ID" length="50" /> </key-property> <key-property name="stackLevel" type="string"> <column name="STACK_LEVEL" length="1" /> </key-property> <key-property name="severityLevel" type="string"> <column name="SEVERITY_LEVEL" length="10" /> </key-property> <key-property name="componentId" type="string"> <column name="COMPONENT_ID" length="20" /> </key-property> <key-property name="parent" type="string"> <column name="PARENT" length="256" /> </key-property> <key-property name="serviceName" type="string"> <column name="SERVICE_NAME" length="256" /> </key-property> <key-property name="portType" type="string"> <column name="PORT_TYPE" length="256" /> </key-property> <key-property name="operation" type="string"> <column name="OPERATION" length="256" /> </key-property> <key-property name="message" type="string"> <column name="MESSAGE" length="4096" /> </key-property> <key-property name="detail" type="string"> <column name="DETAIL" length="4096" /> </key-property> </composite-id> </class> </hibernate-mapping>
EsbCommonlog.java package model;
// Generated 26-mag-2010 14.49.58 by Hibernate Tools 3.3.0.GA
/** * EsbCommonlog generated by hbm2java */ public class EsbCommonlog implements java.io.Serializable {
private EsbCommonlogId id;
public EsbCommonlog() { }
public EsbCommonlog(EsbCommonlogId id) { this.id = id; }
public EsbCommonlogId getId() { return this.id; }
public void setId(EsbCommonlogId id) { this.id = id; }
}
EsbCommonlogId.java package model;
// Generated 26-mag-2010 14.49.58 by Hibernate Tools 3.3.0.GA
import java.util.Date;
/** * EsbCommonlogId generated by hbm2java */ public class EsbCommonlogId implements java.io.Serializable {
private Date timeStamp; private String requestId; private String stackLevel; private String severityLevel; private String componentId; private String parent; private String serviceName; private String portType; private String operation; private String message; private String detail;
public EsbCommonlogId() { }
public EsbCommonlogId(Date timeStamp) { this.timeStamp = timeStamp; }
public EsbCommonlogId(Date timeStamp, String requestId, String stackLevel, String severityLevel, String componentId, String parent, String serviceName, String portType, String operation, String message, String detail) { this.timeStamp = timeStamp; this.requestId = requestId; this.stackLevel = stackLevel; this.severityLevel = severityLevel; this.componentId = componentId; this.parent = parent; this.serviceName = serviceName; this.portType = portType; this.operation = operation; this.message = message; this.detail = detail; }
public Date getTimeStamp() { return this.timeStamp; }
public void setTimeStamp(Date timeStamp) { this.timeStamp = timeStamp; }
public String getRequestId() { return this.requestId; }
public void setRequestId(String requestId) { this.requestId = requestId; }
public String getStackLevel() { return this.stackLevel; }
public void setStackLevel(String stackLevel) { this.stackLevel = stackLevel; }
public String getSeverityLevel() { return this.severityLevel; }
public void setSeverityLevel(String severityLevel) { this.severityLevel = severityLevel; }
public String getComponentId() { return this.componentId; }
public void setComponentId(String componentId) { this.componentId = componentId; }
public String getParent() { return this.parent; }
public void setParent(String parent) { this.parent = parent; }
public String getServiceName() { return this.serviceName; }
public void setServiceName(String serviceName) { this.serviceName = serviceName; }
public String getPortType() { return this.portType; }
public void setPortType(String portType) { this.portType = portType; }
public String getOperation() { return this.operation; }
public void setOperation(String operation) { this.operation = operation; }
public String getMessage() { return this.message; }
public void setMessage(String message) { this.message = message; }
public String getDetail() { return this.detail; }
public void setDetail(String detail) { this.detail = detail; }
public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof EsbCommonlogId)) return false; EsbCommonlogId castOther = (EsbCommonlogId) other;
return ((this.getTimeStamp() == castOther.getTimeStamp()) || (this .getTimeStamp() != null && castOther.getTimeStamp() != null && this.getTimeStamp() .equals(castOther.getTimeStamp()))) && ((this.getRequestId() == castOther.getRequestId()) || (this .getRequestId() != null && castOther.getRequestId() != null && this .getRequestId().equals(castOther.getRequestId()))) && ((this.getStackLevel() == castOther.getStackLevel()) || (this .getStackLevel() != null && castOther.getStackLevel() != null && this .getStackLevel().equals(castOther.getStackLevel()))) && ((this.getSeverityLevel() == castOther.getSeverityLevel()) || (this .getSeverityLevel() != null && castOther.getSeverityLevel() != null && this .getSeverityLevel() .equals(castOther.getSeverityLevel()))) && ((this.getComponentId() == castOther.getComponentId()) || (this .getComponentId() != null && castOther.getComponentId() != null && this .getComponentId().equals(castOther.getComponentId()))) && ((this.getParent() == castOther.getParent()) || (this .getParent() != null && castOther.getParent() != null && this.getParent() .equals(castOther.getParent()))) && ((this.getServiceName() == castOther.getServiceName()) || (this .getServiceName() != null && castOther.getServiceName() != null && this .getServiceName().equals(castOther.getServiceName()))) && ((this.getPortType() == castOther.getPortType()) || (this .getPortType() != null && castOther.getPortType() != null && this .getPortType().equals(castOther.getPortType()))) && ((this.getOperation() == castOther.getOperation()) || (this .getOperation() != null && castOther.getOperation() != null && this .getOperation().equals(castOther.getOperation()))) && ((this.getMessage() == castOther.getMessage()) || (this .getMessage() != null && castOther.getMessage() != null && this.getMessage() .equals(castOther.getMessage()))) && ((this.getDetail() == castOther.getDetail()) || (this .getDetail() != null && castOther.getDetail() != null && this.getDetail() .equals(castOther.getDetail()))); }
public int hashCode() { int result = 17;
result = 37 * result + (getTimeStamp() == null ? 0 : this.getTimeStamp().hashCode()); result = 37 * result + (getRequestId() == null ? 0 : this.getRequestId().hashCode()); result = 37 * result + (getStackLevel() == null ? 0 : this.getStackLevel() .hashCode()); result = 37 * result + (getSeverityLevel() == null ? 0 : this.getSeverityLevel() .hashCode()); result = 37 * result + (getComponentId() == null ? 0 : this.getComponentId() .hashCode()); result = 37 * result + (getParent() == null ? 0 : this.getParent().hashCode()); result = 37 * result + (getServiceName() == null ? 0 : this.getServiceName() .hashCode()); result = 37 * result + (getPortType() == null ? 0 : this.getPortType().hashCode()); result = 37 * result + (getOperation() == null ? 0 : this.getOperation().hashCode()); result = 37 * result + (getMessage() == null ? 0 : this.getMessage().hashCode()); result = 37 * result + (getDetail() == null ? 0 : this.getDetail().hashCode()); return result; }
}
Now I want to get the list of the table that is not empty. I use this:
esbcomlog = session.createQuery("from EsbCommonlog").list();
the list result is of size 220 = size of the table but 200 null
Then i try this Criteria c = session.createCriteria("model.EsbCommonlog"); List<EsbCommonlogId> cl= (List<EsbCommonlogId>) c.list();
same thing
any idea?
thanx a lot.
|