How to use Oracle ID function in sleep mode

Until recently, we used Oracle sequences to generate table IDs. Now this change, the new identifier is now calculated by the Oracle function. This means that my application needs a change in order for an adept to be in a new situation. The application is a Spring / Hibernate webApp that accesses an Oracle database. This has been configured in the hbm.xml file as follows:

<class name="TableHib" table="TABLENAME" >
    <id name="Id" type="java.lang.Long">
        <column name="ID" precision="22" scale="0" />
        <generator class="sequence">
            <param name="sequence">SEQTABLE</param>
        </generator>
    </id>

      

The question is, of course, what is the solution to use the result of the Oracle function for the new ID value?

Help is greatly appreciated, thanks in advance.

0


source to share


1 answer


Can you write a Java class that can get the value of an Oracle function? If so, you should be able to define this Java class as<generator class>



Edit: To call an Oracle function from Java, see if this works for you:   Call Oracle Java functions from a Java program and see Java CallableStatement API

+1


source







All Articles