• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

org.hibernate.MappingException

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help please ?
 
Gautam Joshi
Greenhorn
Posts: 18
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic