此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【inspur168】截止到2008-08-02 19:00:52的历史汇总数据(不包括此帖):
发帖的总数量:14                       发帖的总分数:125                      每贴平均分数:8                        
回帖的总数量:9                        得分贴总数量:1                        回帖的得分率:11%                      
结贴的总数量:12                       结贴的总分数:100                      
无满意结贴数:4                        无满意结贴分:65                       
未结的帖子数:2                        未结的总分数:25                       
结贴的百分比:85.71 %               结分的百分比:80.00 %                  
无满意结贴率:33.33 %               无满意结分率:65.00 %                  
楼主加油

取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=inspur168

解决方案 »

  1.   

    设置show_sql为true,看看具体执行的sql语句是什么
      

  2.   

    Hibernate: select users0_.userId as userId19_0_, users0_.username as username19_0_, users0_.realname as realname19_0_, users0_.password as password19_0_, users0_.sex as sex19_0_, users0_.address as address19_0_, users0_.tel as tel19_0_, users0_.age as age19_0_, users0_.mtel as mtel19_0_, users0_.addtime as addtime19_0_ from EIMS.dbo.Users users0_ where users0_.userId=?
    Hibernate: select spus0_.userId as userId1_, spus0_.spuId as spuId1_, spus0_.spuId as spuId18_0_, spus0_.userId as userId18_0_, spus0_.spId as spId18_0_, spus0_.addtime as addtime18_0_ from EIMS.dbo.spu spus0_ where spus0_.userId=?
    Hibernate: select spu0_.spuId as spuId18_, spu0_.userId as userId18_, spu0_.spId as spId18_, spu0_.addtime as addtime18_ from EIMS.dbo.spu spu0_ where spu0_.userId=?
    Hibernate: select sp0_.spId as spId17_, sp0_.postId as postId17_, sp0_.soId as soId17_, sp0_.note as note17_ from EIMS.dbo.sp sp0_
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select post0_.postId as postId11_0_, post0_.postDesc as postDesc11_0_, post0_.note as note11_0_ from EIMS.dbo.post post0_ where post0_.postId=?
    Hibernate: select so0_.soId as soId14_0_, so0_.soDesc as soDesc14_0_, so0_.note as note14_0_, so0_.flag as flag14_0_ from EIMS.dbo.so so0_ where so0_.soId=?
      

  3.   

    上面是执行的SQL语句,其中:so是科室表 post是职务表 user是用户表 spu是三个的ID组成看样子没错呀
      

  4.   

    请问你取出来的集合是保存在Set还是List里的?
      

  5.   

    建议你贴查询和POJO类 和 hbm文件的代码 看看!
      

  6.   

    So.hbm.xml文件内容:<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.eims.domain.So" table="so" schema="dbo" catalog="EIMS">
            <id name="soId" type="java.lang.Integer">
                <column name="soId" />
                <generator class="native" />
            </id>
            <property name="soDesc" type="java.lang.String">
                <column name="soDesc" length="10" not-null="true" />
            </property>
            <property name="note" type="java.lang.String">
                <column name="note" length="100" />
            </property>
            <property name="flag" type="java.lang.String">
                <column name="flag" length="1" not-null="true" />
            </property>
            <set name="soms" inverse="true">
                <key>
                    <column name="soid" not-null="true" />
                </key>
                <one-to-many class="com.eims.domain.Som" />
            </set>
            <set name="sps" inverse="true">
                <key>
                    <column name="soId" not-null="true" />
                </key>
                <one-to-many class="com.eims.domain.Sp" />
            </set>
            <set name="ideas" inverse="true">
                <key>
                    <column name="soid" not-null="true" />
                </key>
                <one-to-many class="com.eims.domain.Idea" />
            </set>
        </class>
    </hibernate-mapping>
      

  7.   

    Post.hbm.xml文件内容:<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
    <class name="com.eims.domain.Post" table="post" schema="dbo"
    catalog="EIMS">
    <id name="postId" type="java.lang.Integer">
    <column name="postId" />
    <generator class="native" />
    </id>
    <property name="postDesc" type="java.lang.String">
    <column name="postDesc" length="20" not-null="true" />
    </property>
    <property name="note" type="java.lang.String">
    <column name="note" length="100" />
    </property>
    <set name="sps" inverse="true" cascade="save-update">
    <key>
    <column name="postId" not-null="true" />
    </key>
    <one-to-many class="com.eims.domain.Sp" />
    </set>
    </class>
    </hibernate-mapping>
      

  8.   

    看你log,发现你用了二级缓存了吧,数据库被改动了,但是hibernate没有更新缓存
    建议关闭二级缓存。
      

  9.   


    可以试下用Set集合取出保存,记得myeclipse自动默认生成的是Set
      

  10.   

    Sp.hbm.xml文件内容:<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.eims.domain.Sp" table="sp" schema="dbo" catalog="EIMS">
            <id name="spId" type="java.lang.Integer">
                <column name="spId" />
                <generator class="native" />
            </id>
            <many-to-one name="post" class="com.eims.domain.Post" fetch="select" lazy="false">
                <column name="postId" not-null="true" />
            </many-to-one>
            <many-to-one name="so" class="com.eims.domain.So" fetch="select" lazy="false">
                <column name="soId" not-null="true" />
            </many-to-one>
            <property name="note" type="java.lang.String">
                <column name="note" length="100" />
            </property>
            <set name="PFs" inverse="true">
                <key>
                    <column name="spId" not-null="true" />
                </key>
                <one-to-many class="com.eims.domain.PF" />
            </set>
            <set name="spus" inverse="true">
                <key>
                    <column name="spId" not-null="true" />
                </key>
                <one-to-many class="com.eims.domain.Spu" />
            </set>
        </class>
    </hibernate-mapping>POJO类:
    So.javapackage com.eims.domain;import java.util.HashSet;
    import java.util.Set;/**
     * So entity.
     * 
     * @author MyEclipse Persistence Tools
     */public class So implements java.io.Serializable { // Fields private Integer soId;
    private String soDesc;
    private String note;
    private String flag;
    private Set soms = new HashSet(0);
    private Set sps = new HashSet(0);
    private Set ideas = new HashSet(0); // Constructors /** default constructor */
    public So() {
    } /** minimal constructor */
    public So(String soDesc, String flag) {
    this.soDesc = soDesc;
    this.flag = flag;
    } /** full constructor */
    public So(String soDesc, String note, String flag, Set soms, Set sps,
    Set ideas) {
    this.soDesc = soDesc;
    this.note = note;
    this.flag = flag;
    this.soms = soms;
    this.sps = sps;
    this.ideas = ideas;
    } // Property accessors public Integer getSoId() {
    return this.soId;
    } public void setSoId(Integer soId) {
    this.soId = soId;
    } public String getSoDesc() {
    return this.soDesc;
    } public void setSoDesc(String soDesc) {
    this.soDesc = soDesc;
    } public String getNote() {
    return this.note;
    } public void setNote(String note) {
    this.note = note;
    } public String getFlag() {
    return this.flag;
    } public void setFlag(String flag) {
    this.flag = flag;
    } public Set getSoms() {
    return this.soms;
    } public void setSoms(Set soms) {
    this.soms = soms;
    } public Set getSps() {
    return this.sps;
    } public void setSps(Set sps) {
    this.sps = sps;
    } public Set getIdeas() {
    return this.ideas;
    } public void setIdeas(Set ideas) {
    this.ideas = ideas;
    }}Sp.java:package com.eims.domain;import java.util.HashSet;
    import java.util.Set;/**
     * Sp entity.
     * 
     * @author MyEclipse Persistence Tools
     */public class Sp implements java.io.Serializable { // Fields private Integer spId;
    private Post post;
    private So so;
    private String note;
    private Set PFs = new HashSet(0);
    private Set spus = new HashSet(0); // Constructors /** default constructor */
    public Sp() {
    } /** minimal constructor */
    public Sp(Post post, So so) {
    this.post = post;
    this.so = so;
    } /** full constructor */
    public Sp(Post post, So so, String note, Set PFs, Set spus) {
    this.post = post;
    this.so = so;
    this.note = note;
    this.PFs = PFs;
    this.spus = spus;
    } // Property accessors public Integer getSpId() {
    return this.spId;
    } public void setSpId(Integer spId) {
    this.spId = spId;
    } public Post getPost() {
    return this.post;
    } public void setPost(Post post) {
    this.post = post;
    } public So getSo() {
    return this.so;
    } public void setSo(So so) {
    this.so = so;
    } public String getNote() {
    return this.note;
    } public void setNote(String note) {
    this.note = note;
    } public Set getPFs() {
    return this.PFs;
    } public void setPFs(Set PFs) {
    this.PFs = PFs;
    } public Set getSpus() {
    return this.spus;
    } public void setSpus(Set spus) {
    this.spus = spus;
    }}Post.javapackage com.eims.domain;import java.util.HashSet;
    import java.util.Set;/**
     * Post entity.
     * 
     * @author MyEclipse Persistence Tools
     */public class Post implements java.io.Serializable { // Fields private Integer postId;
    private String postDesc;
    private String note;
    private Set sps = new HashSet(0); // Constructors /** default constructor */
    public Post() {
    } /** minimal constructor */
    public Post(String postDesc) {
    this.postDesc = postDesc;
    } /** full constructor */
    public Post(String postDesc, String note, Set sps) {
    this.postDesc = postDesc;
    this.note = note;
    this.sps = sps;
    } // Property accessors public Integer getPostId() {
    return this.postId;
    } public void setPostId(Integer postId) {
    this.postId = postId;
    } public String getPostDesc() {
    return this.postDesc;
    } public void setPostDesc(String postDesc) {
    this.postDesc = postDesc;
    } public String getNote() {
    return this.note;
    } public void setNote(String note) {
    this.note = note;
    } public Set getSps() {
    return this.sps;
    } public void setSps(Set sps) {
    this.sps = sps;
    }}