Came across link which says it is not advisible to use table identifier generator
Is it the same what we are doing ?(table-identifier-generator is same as TableGenerator ?)
If yes, we have to take it as cleanup task after hibernate upgrade.
How can i replace doWorkInNewTransaction(session) with
delegateWork(org.hibernate.jdbc.WorkExecutorVisitable work, boolean transacted) from JdbcIsolationDelegate
To avoid the performance impact we have some customization done.
As per your advise we can take it(removing custom table generator) up later.
As i told you, this is old project and i am just doing hibernate upgrade.
But as first step i need to get this working.
I want to know how to replace doWorkInNewTransaction(session) by using IsolationDelegate.
When i search in google i find only hibernate 3 ways.
Is there any blog or any example on how to implement this in hibernate 5 ?
As per your advise, “table generator is a bad idea” we will take it up later.
But as of now, we need to use existing mechanism “table generator”.
Any pointers will be really helpful.
I’m not aware of any such blog post since the vast majority of developers use the generator as provided by Hibernate. Anyone who needs a custom implementation needs to study the source code. It’s just code after all.
I think i did not explain it properly, so providing more detail.
We have a product which is used by many customers.
Ex. Events will be raised incase application is not behaving as expected.
eventid is auto generated currently with the help of CustomTableGenerator by extending TableGenerator.
say the following events are generated
volume ‘vol1’ is full(id = 10000)
volume is not writable(id = 20000)
volume has breached threshold(id = 30000)
No permission to write into the volume(id = 40000)
Now with this release we upgrade hibernate and we replace TableGenerator with either SEQUENCE or IDENTITY.
Suppose a new event is generated "volume ‘vol2’ is full(id = ?) ?
I want id to continue from where it was left 40000, 50000, 60000, 70000 and so on.
How can i ensure id continues from where it was left(Maximum number).
SequenceStyleGenerator is capable of working against databases that do not support sequences by switching to a table as the underlying backing.
Doesn’t that specify for our needs, we need to use either sequence or table, since mysql does not support sequence, we are forced to use table as SequenceStyleGenerator supports sequence and table ?
I feel backward compatibility for Custom tablegenerator is removed.
I am unable to understand how to get nextValue which was working in earlier release.
I checked our code and we are using mysql community edition with mariadb connector in our product. Unfortunately i cannot use mariadb 10.3 in our product.
Even after knowing, tablegenerator has performance issues, i am forced to continue with TableGenerator.
I have to retain custom table generator.
I am little curious as to why backward compatibility was removed for table generator.