facebook

Hibernate reverse engineering(sequence generator for col)

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

    Hello,
    I am having one table having one primary key and for that i use oracle sequence to generate its value, i want to use it from spring-config.xml file?

    while reverse engineering of tables ? can any one tell me how to do it ?

    Thanks
    Faisal khan

    #270791 Reply

    Riyad Kalla
    Member

    Faisal,
    I don’t understand the request. When you reverse engineer the table you will get a POJO who’s key has a generator value of native to let the table assign it’s value. That’s fine.

    I don’t understand your spring question though… how does this relate to Spring?

    #270843 Reply

    ok i try to repat the question,

    I have one column hold primary key, we need to put every time uniqe value for it, i have one oracle sequence when we execute that sequence it generate different value from previously generated then we insert that value into that table.

    I saw one example some thing like this

    <id name=”userId” type=”integer” column=”USER_ID” >
    <generator class=”sequence”>
    <param name=”sequence”>MD_USER_SEQ</param>
    </generator>
    </id>

    which i guess automaticaly call sequence inside oracle and assign value to the userid.
    but we have t do it manualy if i m not wrong,
    while reverse enginering i saw option to configure for column but do not know how to use.

    hope nnow you understand the question clearly.

    Thanks
    Faisal khan

    #270846 Reply

    Riyad Kalla
    Member

    Faisal,
    I believe what you want is to set the value to “native” which means the database takes care of the value, otherwise “Sequence” tells Hibernate to generate a sequential value for the field.

    #270905 Reply

    I understand that.

    but do you think if we assign sequence from reverse engineering dialog to any specifc col, does it ask for sequence name which i want to bound for specific column ?

    <id name=”userId” type=”integer” column=”USER_ID” >
    <generator class=”sequence”>
    <param name=”sequence”>MD_USER_SEQ</param>
    </generator>
    </id>

    Faisal khan

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Hibernate reverse engineering(sequence generator for col)

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