facebook

the PK is not generated

  1. MyEclipse Archived
  2.  > 
  3. UML Development
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #234914 Reply

    xzy_love
    Member

    <?xml version=”1.0″ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-mapping PUBLIC
    “-//Hibernate/Hibernate Mapping DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#8221; >

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <!– Created Tue Aug 16 16:26:10 CST 2005 –>
    <hibernate-mapping package=”com.chinabach.trip.center.pojo”>

    <class name=”OrderRoomInfo” table=”ORDER_ROOM_INFO”>

    <property name=”orederRoomId” column=”OREDER_ROOM_ID” type=”java.lang.String” not-null=”true” />
    <property name=”hotelhomeId” column=”HOTELHOME_ID” type=”java.lang.String” />
    <property name=”orderId” column=”ORDER_ID” type=”java.lang.String” />
    <property name=”quantity” column=”QUANTITY” type=”java.lang.Long” />
    <property name=”persons” column=”PERSONS” type=”java.lang.Long” />
    <property name=”addBed” column=”ADD_BED” type=”java.lang.String” />
    <property name=”inDate” column=”IN_DATE” type=”java.lang.String” />
    <property name=”outDate” column=”OUT_DATE” type=”java.lang.String” />
    <property name=”comeWay” column=”COME_WAY” type=”java.lang.String” />
    <property name=”lastTime” column=”LAST_TIME” type=”java.lang.String” />
    <property name=”price” column=”PRICE” type=”java.lang.String” />
    </class>

    </hibernate-mapping>

    this file is generated by M3 from database table.why the PK is not generated ??????

    #234918 Reply

    support-michael
    Keymaster

    What database did you use to generate this mapping file?

    #234921 Reply

    xzy_love
    Member

    the database is oracle
    when generate mapping file,some mapping file is right,some mapping file is wrong.

    #234922 Reply

    xzy_love
    Member

    the database is oracle 9.2

    #234924 Reply

    support-michael
    Keymaster

    Can you post the DDL for 1 or more of the tables for which mapping file generation is dorking up? Please note that the MyEclpse portal software is hyper-senstivite to direct DDL content so please change all statements to something like the following before submitting:

    CREATE TAB*E ...
    #234927 Reply

    xzy_love
    Member

    eclipse3.01+myeclipse3.82 is ok
    but eclipse3.1+myeclipse4.0M3 is wrong

    #234941 Reply

    Brian Fernandes
    Moderator

    xyz,

    You said it was working in 3.0.1 + 3.82 – did you mean MyEclipse 3.8.2 or MyEclipse 3.8.4? Can you check right now in that version of MyEclipse whether the hibernate mapping is generated as expected, maybe your Table structure has changed since you tried in 3.8.4?

    In 4.0M3, select the table in the DB Browser, can you see the primary key listed in the Primary Key tab in the Table Info view? Can you try other tables and see if the hibernate mapping is generated correctly for them – can you see their Primary Key details in the Table Info view?

    If you can paste your DDL here for us as Michael requested above, that would really help tracking this down.

    Best,
    Brian.

    #235033 Reply

    xzy_love
    Member

    In 4.0M3,I select the table in the DB Browser, I can see the primary key listed in the Primary Key tab in the Table Info view. some hibernate mapping is generated correctly ,some is wrong ,in the wrong mapping file,the Primary key was as a property
    <?xml version=”1.0″ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-mapping PUBLIC
    “-//Hibernate/Hibernate Mapping DTD 2.0//EN”
    http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#8221; >

    <!– DO NOT EDIT: This is a generated file that is synchronized –>
    <!– by MyEclipse Hibernate tool integration. –>
    <!– Created Tue Aug 16 16:26:10 CST 2005 –>
    <hibernate-mapping package=”com.chinabach.trip.center.pojo”>

    <class name=”OrderRoomInfo” table=”ORDER_ROOM_INFO”>

    <property name=”orederRoomId” column=”OREDER_ROOM_ID” type=”java.lang.String” not-null=”true” />
    <property name=”hotelhomeId” column=”HOTELHOME_ID” type=”java.lang.String” />
    <property name=”orderId” column=”ORDER_ID” type=”java.lang.String” />
    <property name=”quantity” column=”QUANTITY” type=”java.lang.Long” />
    <property name=”persons” column=”PERSONS” type=”java.lang.Long” />
    <property name=”addBed” column=”ADD_BED” type=”java.lang.String” />
    <property name=”inDate” column=”IN_DATE” type=”java.lang.String” />
    <property name=”outDate” column=”OUT_DATE” type=”java.lang.String” />
    <property name=”comeWay” column=”COME_WAY” type=”java.lang.String” />
    <property name=”lastTime” column=”LAST_TIME” type=”java.lang.String” />
    <property name=”price” column=”PRICE” type=”java.lang.String” />
    </class>

    </hibernate-mapping>

    the ‘orederRoomId’ is the primary key .

    #235035 Reply

    support-michael
    Keymaster

    In order for us to isolate the behavior you are seeing we need to have the DDL for the ORDER_ROOM_INFO table that the mapping file was derived. Please provide that info and we should be able to resolve this issue quickly.

    #235048 Reply

    xzy_love
    Member

    become I can’t post the code,can you give me your email;I email it to you

    #235049 Reply

    support-michael
    Keymaster

    support@genuitec.com – please include the title of this thread

    #235059 Reply

    support-michael
    Keymaster

    Thanks for send the DDL as it allowed me to quickly setup a test on an Oracle 9.2 server. Unfortunately I am not able to replicate the problem you have identified using the MyEclipse Hibernate Reverse-engineering Mapping Wizard. What identity method are you specifying in this wizard?

    You mentioned your problem is with M3. Do you have non-MyEclipse plugins running?

    <hibernate-mapping package="com.bar">
    
        <class name="OrderRoomInfo" table="ORDER_ROOM_INFO">
            <id name="orederRoomId" column="OREDER_ROOM_ID" type="string">
                <generator class="hilo"/>
            </id>
     
            <property name="hotelhomeId" column="HOTELHOME_ID" type="string" />
            .....
    
    #235177 Reply

    xzy_love
    Member

    if you use the MyEclipse Hibernate Reverse-engineering Mapping Wizard to this table only,it is ok,but when use it to many table in one time,you will know that some is ok,some is not ok.

    #235179 Reply

    support-michael
    Keymaster

    I’m not able to replicate the problem you describe. As an example I just generated POJO mappings for the entire Oracle HR example scheme by selecting every table and launching the rev-eng mapping wizard. Every table with a PK had a corresponding mapping file generated with the proper <id> element.

    The problem you describe does not sound like MyEclipse related but we need to confirm. If you have this schema available can you try an experiment and generate mappings for it to see if the problem is with your schema or with MyEclipse?

    Finally I asked in an earlier reply if you have other plugins installed in addition to MyEclipse. Can you provide this information?

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: the PK is not generated

You must be logged in to post in the forum log in