facebook

Auto increment

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #291526 Reply

    Douglas M Hurst
    Participant

    I’m using 6.6 GA. I know it’s up-to-date at home, but here at work, I have trouble connecting to get updates. At any rate…

    I’m reverse engineering with MySql. My key fields are auto increment. When I do the reverse engineering, it always generates

    <hibernate-mapping>
    <class name=”com.lmco.chassis.hibernate.User” table=”user” catalog=”test”>
    <id name=”id” type=”java.lang.Integer”>
    <column name=”id” />
    <generator class=”identy” />
    </id>
    <property name=”username” type=”java.lang.String”>
    <column name=”username” length=”64″ not-null=”true” />
    </property>

    … and I have to change it to…

    <hibernate-mapping>
    <class name=”com.lmco.chassis.hibernate.User” table=”user” catalog=”test”>
    <id name=”id” type=”java.lang.Integer”>
    <column name=”id” />
    <generator class=”increment” />
    </id>
    <property name=”username” type=”java.lang.String”>
    <column name=”username” length=”64″ not-null=”true” />
    </property>

    … in order to input (save) a record.

    Isn’t there a generation script somewhere that can be changed to make this insert “increment” instead of “identity?”

    #291547 Reply

    Loyal Water
    Member

    You can make the change in the Hibernate DAO template. You can refer to section 5.5 of this document for instructions on how to modify the template:-
    http://www.myeclipseide.com/documentation/quickstarts/hibernate/#5-5

    You can even change the generator on the 3rd page of the reverse engineering wizard but this way you would have to do it for all tables for which you want increment.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Auto increment

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