Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.MappingException

 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I am getting this exception
org.hibernate.MappingException: Unable to find column with logical name: order_id in org.hibernate.mapping.Table(orders) and its related supertables and secondary tables


My entity classes :
Order.java


OrderLine.java


my Db :
orders

orderlines


Please help me.
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mayur,

In your query of orderlines just chek out the line no. 9 : remove underscore( _ ) from the ('order_id') and check it out.
 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. It says "Key column 'order id' doesn't exist in table".
 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help please ?
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mayur,

I think you should try this.

Just remove the quotes of TABLE names and COLUMN names from the CREATE TABLE statements.

I think this link will help you : https://hibernate.atlassian.net/browse/HHH-7713
 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gautam Joshi wrote:Hi Mayur,

I think you should try this.

Just remove the quotes of TABLE names and COLUMN names from the CREATE TABLE statements.

I think this link will help you : https://hibernate.atlassian.net/browse/HHH-7713


Thanks for your suggestions Gautam. I tried everything. Now changed code and its working fine.
Still if you get any idea to make this code work do share with me.
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayur,

What changes you have made in your code if you will share here, It will be helpful to others too..

Thanks..
 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed the jointable to implement a bi-directional one to many mapping.
Now code look like this.

Order.java

Orderline.java
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
O.K. Mayur, I got it. and again Thanks.. for sharing.
 
p mayur
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now i am getting another issue. When i save the order, record is successfully inserted into table 'orders'.But my 'orderlines' table is empty.
This is the save operation in Controller.

Can someone point me what wrong i am doing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic