[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - JPA persistence primary key loose
stephan.opitz
do-not-reply at jboss.com
Tue Sep 19 15:35:11 EDT 2006
i make a customer object persistent
// create a new customer
customer = new Customers();
// fill with data
customer.setEmail(email);
customer.setPassword(password);
// make persistent
customersFacade.save(customer);
after persists i know the new id is in db 11, but if i log its 0
why it won*t set automattically
log.info("customer ID: " + customer.getCustomersId());
entity has this:
@Entity
@Table(name = "customers")
public class Customers implements Serializable {
// ------------------------------------------------------ Manifest Constants
private static final long serialVersionUID = 5L;
// ------------------------------------------------------- Public Properties
private long customersId;
private String firstName;
private String lastName;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "customers_id")
public long getCustomersId() {
return customersId;
}
...
should work or how it works?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972714#3972714
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972714
More information about the jboss-user
mailing list