Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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.
 
My, my, aren't you a big fella. Here, have a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic