alanmehio wrote:
hi,
just some thoughts
final DataStore data1 = new DataStore(data);
try to replace the above with
DataStore data1 = data
I am still did not get it why you create a DataStore from a DataStore?
Your code is trying to modify a primary key ( surrogate key ) which is not allowed.
Caused by: java.sql.SQLException: Attempt to modify an identity column 'ID'.
Hi,
My mistake I've already modify my code
public void populateData(DataStore data) {
try {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(data);
session.getTransaction().commit();
} catch (HibernateException e) {
e.printStackTrace();
}
}
But still I can't understand why my code trying to modify the primary key when It was suppose to store a new persistent object w/o trying to modify it.
DataStore data = new DataStore();
data.setParent(2);
data.setData("data3");
data.setTypes("types3");
I can only retrieve the data that are already in the database, and what I'm trying to do is that my client can also populate my database then retrieve it Asynchronously, am I missing some configuration or anything?
Thank you very much.