-->
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: about SessionFactory Level Cache
PostPosted: Mon Jul 18, 2005 2:57 am 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
Hi,all:

hibernate2.1,ehcache

in hibernate config file:applicationContext.xml
<bean id="sessionFactory" ...
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
.......
<prop key="hibernate.cache.provider_class">
net.sf.ehcache.hibernate.Provider
</prop>
</props>

in web-inf/ehcache.xml:
<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveseconds="120"
overflowToDisk="true"
/>
<cache name="org.hibernate.pojos.User"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="false"
/>
</ehcache>

in User.hbm.xml:
<class
name="org.hibernate.pojos.User"
table="Users"
>
<cache usage="read-write" />
.................
error:
Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: invalid mapping
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:356)

remove the <cache usage="read-write" /> in User.hbm.xml is ok,what's wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 4:54 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Check your log further, there should be description of the mapping error. And try to validate the mapping document manually: a lot of IDEs do it

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 5:12 am 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
all the log there:
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:356)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:260)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:221)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:224)
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:150)
org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:108)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:108)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:334)
org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:82)
org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:369)
org.jboss.web.WebModule.startModule(WebModule.java:62)
org.jboss.web.WebModule.startService(WebModule.java:40)
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:844)
$Proxy18.start(Unknown Source)
org.jboss.system.ServiceController.start(ServiceController.java:369)
sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
$Proxy32.start(Unknown Source)
org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:362)
org.jboss.deployment.MainDeployer.start(MainDeployer.java:863)
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:674)
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:637)
sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
$Proxy7.deploy(Unknown Source)
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:844)
$Proxy0.start(Unknown Source)
org.jboss.system.ServiceController.start(ServiceController.java:369)
sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
$Proxy4.start(Unknown Source)
org.jboss.deployment.SARDeployer.start(SARDeployer.java:260)
org.jboss.deployment.MainDeployer.start(MainDeployer.java:863)
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:674)
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:637)
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:230)
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
$Proxy5.deploy(Unknown Source)
org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:387)
org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
org.jboss.Main.boot(Main.java:151)
org.jboss.Main$1.run(Main.java:405)
java.lang.Thread.run(Thread.java:534)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 7:35 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
To tell you the truth I don't see any org.hibernate exception in that log. I think your spring app. context is not configured properly or something else. You can post the full hibernate mapping for xxx.pojos.Users and the java class, I will try to help you. I have a spring application working with hibernate and can add your mapping and class into it to check if everything is OK with your hibernate mapping.

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 9:12 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
thank you so much, shl

User.hbm.xml:
<?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>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="org.hibernate.pojos.User"
table="Users"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
>
<cache usage="read-write"/>

<meta attribute="class-description" inherit="false">
@hibernate.class
table="Users"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
</meta>

<id
name="userid"
type="java.lang.String"
column="USERId"
>
<meta attribute="field-description">
@hibernate.id
generator-class="uuid.hex"
type="java.lang.String"
column="USERId"


</meta>
<generator class="uuid.hex" />
</id>

<property
name="useruserGid"
type="java.math.BigDecimal"
column="USERUserGId"
length="20"
>
<meta attribute="field-description">
@hibernate.property
column="USERUserGId"
length="20"
</meta>
</property>
<property
name="userentpId"
type="java.lang.Integer"
column="USEREntpId"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="USEREntpId"
length="10"
</meta>
</property>
<property
name="username"
type="java.lang.String"
column="USERName"
length="50"
>
<meta attribute="field-description">
@hibernate.property
column="USERName"
length="50"
</meta>
</property>
<property
name="usercomputerId"
type="java.lang.String"
column="USERComputerId"
length="30"
>
<meta attribute="field-description">
@hibernate.property
column="USERComputerId"
length="30"
</meta>
</property>
<property
name="usercomputerIdType"
type="java.lang.String"
column="USERComputerIdType"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="USERComputerIdType"
length="4"
</meta>
</property>
<property
name="userpassword"
type="java.lang.String"
column="USERPassword"
length="64"
>
<meta attribute="field-description">
@hibernate.property
column="USERPassword"
length="64"
</meta>
</property>
<property
name="userquestion"
type="java.lang.String"
column="USERQuestion"
length="100"
>
<meta attribute="field-description">
@hibernate.property
column="USERQuestion"
length="100"
</meta>
</property>
<property
name="useranswer"
type="java.lang.String"
column="USERAnswer"
length="100"
>
<meta attribute="field-description">
@hibernate.property
column="USERAnswer"
length="100"
</meta>
</property>
<property
name="useremail"
type="java.lang.String"
column="USEREmail"
length="100"
>
<meta attribute="field-description">
@hibernate.property
column="USEREmail"
length="100"
</meta>
</property>
<property
name="userentpName"
type="java.lang.String"
column="USEREntpName"
length="255"
>
<meta attribute="field-description">
@hibernate.property
column="USEREntpName"
length="255"
</meta>
</property>
<property
name="usertype"
type="java.lang.String"
column="USERType"
length="3"
>
<meta attribute="field-description">
@hibernate.property
column="USERType"
length="3"
</meta>
</property>
<property
name="userattribute"
type="java.lang.String"
column="USERAttribute"
length="3"
>
<meta attribute="field-description">
@hibernate.property
column="USERAttribute"
length="3"
</meta>
</property>
<property
name="userrealName"
type="java.lang.String"
column="USERRealName"
length="50"
>
<meta attribute="field-description">
@hibernate.property
column="USERRealName"
length="50"
</meta>
</property>
<property
name="usersex"
type="java.lang.String"
column="USERSex"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="USERSex"
length="2"
</meta>
</property>
<property
name="usersource"
type="java.lang.String"
column="USERSource"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="USERSource"
length="10"
</meta>
</property>
<property
name="useraddress"
type="java.lang.String"
column="USERAddress"
length="255"
>
<meta attribute="field-description">
@hibernate.property
column="USERAddress"
length="255"
</meta>
</property>
<property
name="userpostCode"
type="java.lang.String"
column="USERPostCode"
length="15"
>
<meta attribute="field-description">
@hibernate.property
column="USERPostCode"
length="15"
</meta>
</property>
<property
name="useridNumber"
type="java.lang.String"
column="USERIdNumber"
length="20"
>
<meta attribute="field-description">
@hibernate.property
column="USERIdNumber"
length="20"
</meta>
</property>
<property
name="userwork"
type="java.lang.String"
column="USERWork"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="USERWork"
length="4"
</meta>
</property>
<property
name="usereducation"
type="java.lang.String"
column="USEREducation"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="USEREducation"
length="2"
</meta>
</property>
<property
name="usertel"
type="java.lang.String"
column="USERTel"
length="25"
>
<meta attribute="field-description">
@hibernate.property
column="USERTel"
length="25"
</meta>
</property>
<property
name="userstime"
type="java.sql.Timestamp"
column="USERSTime"
length="23"
>
<meta attribute="field-description">
@hibernate.property
column="USERSTime"
length="23"
</meta>
</property>
<property
name="useretime"
type="java.sql.Timestamp"
column="USERETime"
length="23"
>
<meta attribute="field-description">
@hibernate.property
column="USERETime"
length="23"
</meta>
</property>
<property
name="userregisterTime"
type="java.sql.Timestamp"
column="USERRegisterTime"
length="23"
>
<meta attribute="field-description">
@hibernate.property
column="USERRegisterTime"
length="23"
</meta>
</property>
<property
name="userstatus"
type="java.lang.String"
column="USERStatus"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="USERStatus"
length="1"
</meta>
</property>
<property
name="userforumLevel"
type="java.lang.String"
column="USERForumLevel"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="USERForumLevel"
length="4"
</meta>
</property>
<property
name="usernoteNum"
type="java.lang.Integer"
column="USERNoteNum"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="USERNoteNum"
length="10"
</meta>
</property>
<property
name="userremark"
type="java.lang.String"
column="USERRemark"
length="50"
>
<meta attribute="field-description">
@hibernate.property
column="USERRemark"
length="50"
</meta>
</property>
<property
name="userissueLevel"
type="java.lang.String"
column="USERIssueLevel"
length="3"
>
<meta attribute="field-description">
@hibernate.property
column="USERIssueLevel"
length="3"
</meta>
</property>
<property
name="userverityStatus"
type="java.lang.String"
column="USERVerityStatus"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="USERVerityStatus"
length="2"
</meta>
</property>
<property
name="userlock"
type="java.lang.String"
column="USERLock"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="USERLock"
length="1"
</meta>
</property>
<property
name="userissueStatus"
type="java.lang.String"
column="USERIssueStatus"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="USERIssueStatus"
length="2"
</meta>
</property>

<!-- Associations -->


</class>
</hibernate-mapping>[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 9:14 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
User.java:
package org.hibernate.pojos;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import org.apache.commons.lang.builder.ToStringBuilder;


/**
* @hibernate.class
* table="Users"
*
*/
public class User implements Serializable {

/** identifier field */
private String userid;

/** nullable persistent field */
private BigDecimal useruserGid;

/** nullable persistent field */
private Integer userentpId;

/** nullable persistent field */
private String username;

/** nullable persistent field */
private String usercomputerId;

/** nullable persistent field */
private String usercomputerIdType;

/** nullable persistent field */
private String userpassword;

/** nullable persistent field */
private String userquestion;

/** nullable persistent field */
private String useranswer;

/** nullable persistent field */
private String useremail;

/** nullable persistent field */
private String userentpName;

/** nullable persistent field */
private String usertype;

/** nullable persistent field */
private String userattribute;

/** nullable persistent field */
private String userrealName;

/** nullable persistent field */
private String usersex;

/** nullable persistent field */
private String usersource;

/** nullable persistent field */
private String useraddress;

/** nullable persistent field */
private String userpostCode;

/** nullable persistent field */
private String useridNumber;

/** nullable persistent field */
private String userwork;

/** nullable persistent field */
private String usereducation;

/** nullable persistent field */
private String usertel;

/** nullable persistent field */
private Date userstime;

/** nullable persistent field */
private Date useretime;

/** nullable persistent field */
private Date userregisterTime;

/** nullable persistent field */
private String userstatus;

/** nullable persistent field */
private String userforumLevel;

/** nullable persistent field */
private Integer usernoteNum;

/** nullable persistent field */
private String userremark;

/** nullable persistent field */
private String userissueLevel;

/** nullable persistent field */
private String userverityStatus;

/** nullable persistent field */
private String userlock;

/** nullable persistent field */
private String userissueStatus;

/** full constructor */
public User(BigDecimal useruserGid, Integer userentpId, String username, String usercomputerId, String usercomputerIdType, String userpassword, String userquestion, String useranswer, String useremail, String userentpName, String usertype, String userattribute, String userrealName, String usersex, String usersource, String useraddress, String userpostCode, String useridNumber, String userwork, String usereducation, String usertel, Date userstime, Date useretime, Date userregisterTime, String userstatus, String userforumLevel, Integer usernoteNum, String userremark, String userissueLevel, String userverityStatus, String userlock, String userissueStatus) {
this.useruserGid = useruserGid;
this.userentpId = userentpId;
this.username = username;
this.usercomputerId = usercomputerId;
this.usercomputerIdType = usercomputerIdType;
this.userpassword = userpassword;
this.userquestion = userquestion;
this.useranswer = useranswer;
this.useremail = useremail;
this.userentpName = userentpName;
this.usertype = usertype;
this.userattribute = userattribute;
this.userrealName = userrealName;
this.usersex = usersex;
this.usersource = usersource;
this.useraddress = useraddress;
this.userpostCode = userpostCode;
this.useridNumber = useridNumber;
this.userwork = userwork;
this.usereducation = usereducation;
this.usertel = usertel;
this.userstime = userstime;
this.useretime = useretime;
this.userregisterTime = userregisterTime;
this.userstatus = userstatus;
this.userforumLevel = userforumLevel;
this.usernoteNum = usernoteNum;
this.userremark = userremark;
this.userissueLevel = userissueLevel;
this.userverityStatus = userverityStatus;
this.userlock = userlock;
this.userissueStatus = userissueStatus;
}

/** default constructor */
public User() {
}

/**
* @hibernate.id
* generator-class="uuid.hex"
* type="java.lang.String"
* column="USERId"
*
*/
public String getUserid() {
return this.userid;
}

public void setUserid(String userid) {
this.userid = userid;
}

/**
* @hibernate.property
* column="USERUserGId"
* length="20"
*
*/
public BigDecimal getUseruserGid() {
return this.useruserGid;
}

public void setUseruserGid(BigDecimal useruserGid) {
this.useruserGid = useruserGid;
}

/**
* @hibernate.property
* column="USEREntpId"
* length="10"
*
*/
public Integer getUserentpId() {
return this.userentpId;
}

public void setUserentpId(Integer userentpId) {
this.userentpId = userentpId;
}

/**
* @hibernate.property
* column="USERName"
* length="50"
*
*/
public String getUsername() {
return this.username;
}

public void setUsername(String username) {
this.username = username;
}

/**
* @hibernate.property
* column="USERComputerId"
* length="30"
*
*/
public String getUsercomputerId() {
return this.usercomputerId;
}

public void setUsercomputerId(String usercomputerId) {
this.usercomputerId = usercomputerId;
}

/**
* @hibernate.property
* column="USERComputerIdType"
* length="4"
*
*/
public String getUsercomputerIdType() {
return this.usercomputerIdType;
}

public void setUsercomputerIdType(String usercomputerIdType) {
this.usercomputerIdType = usercomputerIdType;
}

/**
* @hibernate.property
* column="USERPassword"
* length="64"
*
*/
public String getUserpassword() {
return this.userpassword;
}

public void setUserpassword(String userpassword) {
this.userpassword = userpassword;
}

/**
* @hibernate.property
* column="USERQuestion"
* length="100"
*
*/
public String getUserquestion() {
return this.userquestion;
}

public void setUserquestion(String userquestion) {
this.userquestion = userquestion;
}

/**
* @hibernate.property
* column="USERAnswer"
* length="100"
*
*/
public String getUseranswer() {
return this.useranswer;
}

public void setUseranswer(String useranswer) {
this.useranswer = useranswer;
}

/**
* @hibernate.property
* column="USEREmail"
* length="100"
*
*/
public String getUseremail() {
return this.useremail;
}

public void setUseremail(String useremail) {
this.useremail = useremail;
}

/**
* @hibernate.property
* column="USEREntpName"
* length="255"
*
*/
public String getUserentpName() {
return this.userentpName;
}

public void setUserentpName(String userentpName) {
this.userentpName = userentpName;
}

/**
* @hibernate.property
* column="USERType"
* length="3"
*
*/
public String getUsertype() {
return this.usertype;
}

public void setUsertype(String usertype) {
this.usertype = usertype;
}

/**
* @hibernate.property
* column="USERAttribute"
* length="3"
*
*/
public String getUserattribute() {
return this.userattribute;
}

public void setUserattribute(String userattribute) {
this.userattribute = userattribute;
}

/**
* @hibernate.property
* column="USERRealName"
* length="50"
*
*/
public String getUserrealName() {
return this.userrealName;
}

public void setUserrealName(String userrealName) {
this.userrealName = userrealName;
}

/**
* @hibernate.property
* column="USERSex"
* length="2"
*
*/
public String getUsersex() {
return this.usersex;
}

public void setUsersex(String usersex) {
this.usersex = usersex;
}

/**
* @hibernate.property
* column="USERSource"
* length="10"
*
*/
public String getUsersource() {
return this.usersource;
}

public void setUsersource(String usersource) {
this.usersource = usersource;
}

/**
* @hibernate.property
* column="USERAddress"
* length="255"
*
*/
public String getUseraddress() {
return this.useraddress;
}

public void setUseraddress(String useraddress) {
this.useraddress = useraddress;
}

/**
* @hibernate.property
* column="USERPostCode"
* length="15"
*
*/
public String getUserpostCode() {
return this.userpostCode;
}

public void setUserpostCode(String userpostCode) {
this.userpostCode = userpostCode;
}

/**
* @hibernate.property
* column="USERIdNumber"
* length="20"
*
*/
public String getUseridNumber() {
return this.useridNumber;
}

public void setUseridNumber(String useridNumber) {
this.useridNumber = useridNumber;
}

/**
* @hibernate.property
* column="USERWork"
* length="4"
*
*/
public String getUserwork() {
return this.userwork;
}

public void setUserwork(String userwork) {
this.userwork = userwork;
}

/**
* @hibernate.property
* column="USEREducation"
* length="2"
*
*/
public String getUsereducation() {
return this.usereducation;
}

public void setUsereducation(String usereducation) {
this.usereducation = usereducation;
}

/**
* @hibernate.property
* column="USERTel"
* length="25"
*
*/
public String getUsertel() {
return this.usertel;
}

public void setUsertel(String usertel) {
this.usertel = usertel;
}

/**
* @hibernate.property
* column="USERSTime"
* length="23"
*
*/
public Date getUserstime() {
return this.userstime;
}

public void setUserstime(Date userstime) {
this.userstime = userstime;
}

/**
* @hibernate.property
* column="USERETime"
* length="23"
*
*/
public Date getUseretime() {
return this.useretime;
}

public void setUseretime(Date useretime) {
this.useretime = useretime;
}

/**
* @hibernate.property
* column="USERRegisterTime"
* length="23"
*
*/
public Date getUserregisterTime() {
return this.userregisterTime;
}

public void setUserregisterTime(Date userregisterTime) {
this.userregisterTime = userregisterTime;
}

/**
* @hibernate.property
* column="USERStatus"
* length="1"
*
*/
public String getUserstatus() {
return this.userstatus;
}

public void setUserstatus(String userstatus) {
this.userstatus = userstatus;
}

/**
* @hibernate.property
* column="USERForumLevel"
* length="4"
*
*/
public String getUserforumLevel() {
return this.userforumLevel;
}

public void setUserforumLevel(String userforumLevel) {
this.userforumLevel = userforumLevel;
}

/**
* @hibernate.property
* column="USERNoteNum"
* length="10"
*
*/
public Integer getUsernoteNum() {
return this.usernoteNum;
}

public void setUsernoteNum(Integer usernoteNum) {
this.usernoteNum = usernoteNum;
}

/**
* @hibernate.property
* column="USERRemark"
* length="50"
*
*/
public String getUserremark() {
return this.userremark;
}

public void setUserremark(String userremark) {
this.userremark = userremark;
}

/**
* @hibernate.property
* column="USERIssueLevel"
* length="3"
*
*/
public String getUserissueLevel() {
return this.userissueLevel;
}

public void setUserissueLevel(String userissueLevel) {
this.userissueLevel = userissueLevel;
}

/**
* @hibernate.property
* column="USERVerityStatus"
* length="2"
*
*/
public String getUserverityStatus() {
return this.userverityStatus;
}

public void setUserverityStatus(String userverityStatus) {
this.userverityStatus = userverityStatus;
}

/**
* @hibernate.property
* column="USERLock"
* length="1"
*
*/
public String getUserlock() {
return this.userlock;
}

public void setUserlock(String userlock) {
this.userlock = userlock;
}

/**
* @hibernate.property
* column="USERIssueStatus"
* length="2"
*
*/
public String getUserissueStatus() {
return this.userissueStatus;
}

public void setUserissueStatus(String userissueStatus) {
this.userissueStatus = userissueStatus;
}

public String toString() {
return new ToStringBuilder(this)
.append("userid", getUserid())
.toString();
}

}
[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 9:20 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
hibernate configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<description>Spring hibernate confguration</description>

<!-- datasource -->

<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>net.sourceforge.jtds.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:jtds:sqlserver://localhost:1433/bookonline</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value></value>
</property>

</bean>

<!-- hibernate support -->

<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
net.sf.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.jdbc.fetch_size">
50
</prop>

<prop key="hibernate.jdbc.batch_size">
30
</prop>
<prop key="hibernate.c3p0.acquire_increment">1</prop>
<prop key="hibernate.c3p0.idle_test_period">100</prop>
<prop key="hibernate.c3p0.max_size">100</prop>
<prop key="hibernate.c3p0.max_statements">0</prop>
<prop key="hibernate.c3p0.min_size">1</prop>
<prop key="hibernate.c3p0.timeout">100</prop>
<prop key="hibernate.cache.provider_class">
net.sf.ehcache.hibernate.Provider
</prop>

</props>
</property>
<property name="mappingResources">
<list>
<value>org/hibernate/pojos/User.hbm.xml</value>
<value>org/hibernate/pojos/Resource.hbm.xml</value>
<value>org/hibernate/pojos/DownloadLog.hbm.xml</value>
<value>org/hibernate/pojos/DownLoadStatistic.hbm.xml</value>
<value>org/hibernate/pojos/ResourcePrice.hbm.xml</value>
</list>
</property>

</bean>

<!--transaction -->

<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<!-- hibernate dao -->

<bean id="userDAO"
class="org.login.hibernate.dao.UserDAO">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="incomeDAO"
class="org.income.hibernate.dao.IncomeDAO">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>

<!--AOP-->

<bean id="copyrightDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="userDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<bean id="incomeDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="incomeDAO" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>


</beans>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 3:58 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
Here is the DTD for class element (http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd):
Code:
<!ELEMENT class (
  meta*,
  (cache|jcs-cache)?,
  (id|composite-id),
  discriminator?,
  (version|timestamp)?,
  (property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,
  ((subclass*)|(joined-subclass*))
)>


According to this DTD meta element must be put before cache element in your mapping document:

Code:
<class
    name="org.hibernate.pojos.User"
    table="Users"
    dynamic-update="false"
    dynamic-insert="false"
    select-before-update="false"
    optimistic-lock="version"
    lazy="true"
    >

    <meta attribute="class-description" inherit="false">
@hibernate.class
table="Users"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
    </meta>

    <cache usage="read-write"/>


I wrote you upper:
Quote:
And try to validate the mapping document manually:

_________________
Leonid Shlyapnikov


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.