devinenik wrote:
I need to have standalone ID generator which is not part of any table mapping. I need to write function which takes a sequence name as argument and returns the next val. what is the best way of doing this ?
Writing your own ID generator is pretty simple. You need to create a class that implements IdentifierGenerator. Inside this class you can do whatever you want to return the id.
Then in your mapping files, just specify your class as the <generator>
Code:
<id name="id" column="MY_ID" type="long">
<generator class="com.blah.blah.MyIdGenerator"/>
</id>
You can look at the code for the standard implementations for examples.