Home > Default > GenerationType.AUTO doesn't work correctly with Kodo and MySQL

GenerationType.AUTO doesn't work correctly with Kodo and MySQL

October 11Hits:0
Advertisement
Greetings,
I'm migrating applications from JBoss/Hibernate to WebLogic/Kodo. The following column annotation:
@Id
@Column(name="CUSTOMER_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
public long getCustomerId()
is supposed to generate auto-increment primary key in mysql. This is what happens with Hibernate. With Kodo, this seems to be equivalent with GenerationType.TABLE as a table named openjpa_sequence_table is created, containing sequence values. So what should one do in order to be able to use true auto-increment strategy with MySQL and Kodo ?
Many thanks in advance,
Nicolas

Answers

Hi Nicolas,
By setting the generation strategy to AUTO, you're essentially letting the JPA provider choose which strategy to use. It looks like Kodo is using the TABLE strategy by default and Hibernate is using the IDENTITY strategy here. You can set the strategy to IDENTITY if you want Kodo to behave similarly to Hibernate. However, it's worth pointing out that there may be a reason for Kodo not using the IDENTITY strategy by default.
The docs at: http://edocs.bea.com/wls/docs103/kodo/full/html/ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc
point out the following:
"Statements inserting into tables with auto-increment / identity columns cannot be batched. After each insert, Kodo must go back to the database to retrieve the last inserted auto-increment value to set back in the persistent object. This can have a negative impact on performance. "
- Matt

Read other 3 answers

Tags:

Related Articles

  • GenerationType.AUTO doesn't work correctly with Kodo and MySQLOctober 11

    Greetings, I'm migrating applications from JBoss/Hibernate to WebLogic/Kodo. The following column annotation: @Id @Column(name="CUSTOMER_ID") @GeneratedValue(strategy = GenerationType.AUTO) public long getCustomerId() is supposed to generate aut

  • I cant read correct single quote from mySQL database...November 30

    I cant read correct single quote from mySQL database, pls help. What i'm talking about. I must import, "J'adore" for example in my DB and I'm doing this. Thats ok. But when I try to read this value from my DB through JDBC I'm receiving SQL excep

  • HT5271 auto fill not working correctlyOctober 11

    Auto fill is not working correctly. How can this be fixed?Leopard 10.6.8 is Snow Leopard. Do this please ... Click your Apple menu icon top left in your screen. From the drop down menu click About This Mac. What version does it say? 10.6     10.5   ?

  • Auto Rotation not working correctly Radius p55w B5112October 11

    It has not worked correctly since I bought it. I have recovered from image fresh again, and then went through and hit windows update and updated 134 updates. Auto rotate does not work in tablet or in presentation mode. The keyboard never shuts off an

  • Mac Pro not auto-negotiating link speed correctlyNovember 30

    We have found that none of our Mac Pros are auto-negotiating their network link speed correctly while running 10.4.10. This happens while booted into the production OS as well as netbooted to a 10.4.10 NetBoot image. The network card can be forced to

  • Magnetic lasso and auto sharpen not working correctlyOctober 11

    anyone having this problem with PSE 3.0Which operating system are you using? What is not working with the Magnetic Lasso Tool and Auto Sharpen? Have you tried resetting the photoshop elements 3 preferences? To reset the preferences: Press and hold th

  • When install printer driver via Bonjour, what information OS/CUPS communicate with printer firmware to auto-detect and find correct PPD to install?November 30

    Hi guys, We are developing printer driver/firmware for Mac OS X 10.5 and up. Right now we have problem that  printer firmware fail to be auto detected by Mac OS 10.5 during installation via Bonjour. Could anyone teach me how the communication works b

  • Auto-Rotate not working correctly after 8.1.1 updateNovember 30

    Updated my iPhone 5s to 8.1.1 last night.  Auto-Rotate will rotate to the side but will not rotate back now. Surely this is not by design??It may be an app that is doing it. If its fine after a reset and then does it at some point, keep track of what

  • Speed Dial not auto refreshing correctly anyone else having this problem?November 30

    Speed Dial is not auto refreshing certain windows correctly.It was my Sandboxie so I had to make some more configurations to it here's a link to the post http://www.sandboxie.com/phpbb/viewtopic.php?t=12048&highlight=speed+dail.Read other 2 answers

  • Hibernate hbm2ddl.auto create-drop doesn't seem to work in 10.3 JPANovember 30

    Greetings, I'm migrating an JPA application from JBoss 5.0 to WebLogic 10.3. In order to simplify the problem, I have the following entity: package fr.simplex_software.p204.domain; import java.io.Serializable; import javax.persistence.*; @Entity @Tab

Copyright (C) 2017 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.111 s.