JBoss Community

How to get the id of entity with auto_increment value?

created by fabio valsecchi in EJB3 Development - View the full discussion

Hi there,

 

I've an entity Order with @GeneratedValue(strategy = GenerationType.IDENTITY) annotation. I've a MySql database

 

 

----------------------------------------------------------------------------------------------------------------

@Entity

@Table(name = "orders")

public class Order implements Serializable {

private static final long serialVersionUID = 3L;

 

          public Order() {

                    super();

    }

 

@Id

          @GeneratedValue(strategy = GenerationType.IDENTITY)

          @Column(name = "id")

    private int id;

 

.....

 

----------------------------------------------------------------------------------------------------------------

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community