Id « MySQL « JPA Q&A





1. JPA: Id column settable both automatically and manually    stackoverflow.com

I'm using MySQL and have the following entity:

class MyEntity {
    @Id
    @GeneratedValue(strategy=IDENTITY)
    @Column(name="id")
    private Integer id;
}
However, I would still ...

2. @IdClass with non primative @Id    stackoverflow.com

I'm trying to add a composite primary key to a class and having a bit of trouble. Here are the classes.

class User {
    private long id;
   ...

3. resthub hibernate mysql id generated error    stackoverflow.com

I'm trying to use Mysql database instead of H2 for simple resthub project, and get runtime error. I get next error, when it tries create table:

[INFO] [SchemaExport.java:226] Running hbm2ddl schema export
[INFO] ...

4. ID not being retrieved after saveOrUpdate in MySQL    forum.hibernate.org

With I change the table definition to eliminate AUTO_INCREMENT from the primary key, I get this exception. org.hibernate.HibernateException: The data base returned no natively generated identity value In MySQL when you select identity for the generator type is AUTO_INCREMENT required on the PK column? If not how will MySQL generate a PK value? Thanks Ed