Forums Register Login

Strange error after em.persist

+Pie Number of slices to send: Send
Hi everyone.
I have an entity "message" with fields emp_id, local_user_id, message_date, message_header, message_id.
I want to save it to a table "message" with corresponding columns.
But after em.persist(message) I got this exception:

org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-00904: "LOCAL_USER_LOCAL_USER_ID": недопустимый идентификатор
{prepstmnt 42 INSERT INTO Message (emp_id, local_user_id, message_date, message_header, emp_emp_id, local_user_local_user_id) VALUES (?, ?, ?, ?, ?, ?) [params=(int) 8, (int) 0, (null) null, (String) , , 7, 9, 6., (null) null, (null) null]} [code=904, state=42000]

Entity "message" has 2 many-to-one relations - local_user and emp. Why JPA tries to insert something to non-existing columns (emp_emp_id, local_user_local_user_id)?
+Pie Number of slices to send: Send
Please post your entities which has the annotations.
+Pie Number of slices to send: Send

I am trying ta save this entity only.
+Pie Number of slices to send: Send
 

Entity "message" has 2 many-to-one relations - local_user and emp.



Assuming that your Message entity has foreign key "emp_id" for Emp and "local_user_id" for Local_user, your annotations should look like:



If you omit the JoinColumn annotation, the EJB 3.0 server would choose a default column name for you, which in this case i guess is turning out to be emp_emp_id and local_user_local_user_id
+Pie Number of slices to send: Send


After this I get compilation error - cannot resolve symbol
What else can I try?
+Pie Number of slices to send: Send
Have you added the following import statement

+Pie Number of slices to send: Send
Yes, of course. Error is in name="emp_id" and name="local_user_id"
+Pie Number of slices to send: Send
And if that doesnt work, can you post the compilation error that you are seeing?
+Pie Number of slices to send: Send
I develop using IDEA, so

These 2 symbols are "emp_id" and "local_user_id"
Mb there is another way??
+Pie Number of slices to send: Send
Not sure what the cause of this compilation errors is, but i do see that you have 2 private member variables:

private int emp_id;
private int local_user_id;



Can you remove these and the corresponding getter/setter and see if it works. Let us know, if it doesn't.
You've gotta fight it! Don't give in! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1463 times.
Similar Threads
Mapping
Is Zirf Slavic?
For Michael Matola
Applet loads times on init!
USB+Windows(needed libruary)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:50:19.