How can I determine the next available key for a table, according to hibernate's key generator? I want to get at this data for some direct JDBC inserts. It seems trivial if I implement my own custom key generator, but I'd prefer not to have to do that. I'm using the id generator "sequence" (at least I'm pretty sure, I'm actually using "native" with McKoi) and would like to leverage that for JDBC inserts if possible.
A related question: I execute some SQL to initialize my database before the app runs for the first time, and I rely on some McKoi table sequences for id generation, but this conflicts with hibernate's key generation. In other words, I need to set up some default entries in table X, and within the app the user can create some entries in X, but the first few tries the user will get primary key conflicts with my default entries (until the hibernate keygen sequence makes it past my table sequence). Is there an easy way around this? One solution is to insert that data via hibernate the first time the application runs, but that requries quite a few changes. Any other options?
Also, if this is easier to handle with another DB, let me know. I'm considering moving away from McKoi.
-Adam
|