User的映射文件
<hibernate-mapping>
<class name="com.cui.beans.User" table="user" catalog="memo">
<id name="uid" type="integer">
<column name="uid" />
<generator class="native" />
</id>
<property name="username" type="string">
<column name="username" length="20" />
</property>
<property name="password" type="string">
<column name="password" length="20" />
</property>
<property name="age" type="integer">
<column name="age" />
</property>
<property name="email" type="string">
<column name="email" length="20" />
</property>
<set name="events" inverse="true" cascade="all">
<key>
<column name="u_id" />
</key>
<one-to-many class="com.cui.beans.Event" />
</set>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="com.cui.beans.User" table="user" catalog="memo">
<id name="uid" type="integer">
<column name="uid" />
<generator class="native" />
</id>
<property name="username" type="string">
<column name="username" length="20" />
</property>
<property name="password" type="string">
<column name="password" length="20" />
</property>
<property name="age" type="integer">
<column name="age" />
</property>
<property name="email" type="string">
<column name="email" length="20" />
</property>
<set name="events" inverse="true" cascade="all">
<key>
<column name="u_id" />
</key>
<one-to-many class="com.cui.beans.Event" />
</set>
</class>
</hibernate-mapping>
解决方案 »
- 帮忙介绍一下如何学习应用webservice?
- 对于Struts中这种url传参乱码怎么处理
- 工作中的朋友,谁知道你们开发J2EE的项目用的Eclipse
- 召集令!!!!!!!!!!!!!!!
- 初学Web Services,对Web Services的疑惑.请各位大虾指点,分不够可以再加.
- 初学者咨询几个简单的问题。
- 各位打扰一下,请问先学习J2EE好呢?还是学习EJB好?
- 请问JB6+WEBLOGIC+SQL2000
- 100分,请教EJB的事务问题
- hibernate 一对多查询的时候HQL语句为啥不要关联两个类
- 急!急!如何取出给出页面代码中的所有标签??
- cookie 客户端无法写入问题
删除了```再试试
还有 user=ud.findById(uid);
中的user你有没有定义啊?ud.findById(uid)返回的应该是UserDAO
public User findById(String id){
........
User user = session.get(User.class,id);
return user;
}
<set name="events" inverse="true" cascade="all">
<key>
<column name="uid" />
</key>
<one-to-many class="com.cui.beans.Event" />
</set>