Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why a duplicate column being created for a foriegn key

Kumar Raja
Ranch Hand
Posts: 547
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a below class file and hbm file defined

As you see, it has an association with Stock class, which I'm omitting for now in this post.

When I looked into logs for org.hibernate.tool.hbm2ddl.SchemaExport, I see the create DDL statement for StockDailyRecord as follows

As you see, it has STOCK and STOCKID. Which are actually one and the same. and when you persist, the value is being duplicated in both the columns. This is not necessary. How can this be fixed?

Please advise.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic