I have created a database with numerous tables. One of my tables there is
no issue with the db generation an ID value, but on another table I get the
Status 500 error mentioned in subject line. The model for the data set up
is identified as an Enitity, and the and ID and Generated Value. The ID
value to be generated on H2 is a BIGINT, AUTO_INCREMENT. The class is
Serialized and a static final value of 1L is declared. See below:
************************************************************************************************************************************************
@Entity
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int customerId;
*****************************************************************************************************************************************************
DOA IMPL
public Customer getCustomerById(int customerId){
Session session = sessionFactory.getCurrentSession();
return (Customer)session.get(Customer.class, customerId);
}
*****************************************************************************************************************************************************
H2 table syntax
CREATE TABLE CUSTOMER(
CUSTOMERID INT AUTO_INCREMENT ,
CUSTOMERFIRSTNAME VARCHAR(255),
CUSTOMERLASTNAME VARCHAR(255),
CUSTOMEREMAIL VARCHAR(255),
CUSTOMERPHONE BIGINT,
USERNAME VARCHAR(255),
PASSWORD VARCHAR(255),
BILLINGADDRESSID INT,
SHIPPINGADDRESSID INT,
CARTID INT,
ENABLED BOOLEAN)
**************************************************************************************************************************************
ROOT CAUSE OF HTTP STATUS 500 ERROR
*root cause*
org.hibernate.HibernateException: The database returned no natively generated
identity value
******************************************************************************
Any ideas??? Please help.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.