[jboss-dev-forums] [EJB3 Development] - How to get the id of entity with auto_increment value?

fabio valsecchi do-not-reply at jboss.com
Sun Feb 10 14:36:12 EST 2013


fabio valsecchi [https://community.jboss.org/people/fabiovalse] created the discussion

"How to get the id of entity with auto_increment value?"

To view the discussion, visit: https://community.jboss.org/message/796928#796928

--------------------------------------------------------------
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
[https://community.jboss.org/message/796928#796928]

Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130210/2c75e468/attachment.html 


More information about the jboss-dev-forums mailing list