I already have created a sequence in the database.
I want to use it to fill an ID field (auto-incremented then) of a table.
I did not create an entity for that table (i have to use a specific API to insert data into that table).
How can i get that sequence in Hibernate and use it to set the value of that ID field ?
Without using an entity that maps to that table.
well, i guess i could map it, but then i would use the entity only to get the next value of the sequence so i can use it to insert it into the table.
I'm not sure I understand. If your sequence exists to provide a primary key for a specific table you would map that table to a class. Hibernate would take care of getting/setting the key based on the next value from the sequence when you persisted a new instance of that class if you used the sequence key generation strategy in your mapping.
We are using product that ships with some API that we are required to use to modify/create/delete objects