• 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

Replacing *.hbm.xml files with @Annotations.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have three java classes that are persisted using hibernate. I want to switch from using *.hbm.xml files to annotations on these classes. However the db has additional tables that are created by tags in hbm.xml. Is there a way to create these extra tables using annotations without having to create additional java classes.


One of the java classes that result in two tables in db:




hbm.xml file for the Attribute class:




The resulting sql script:



Any help is much apprecated.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm wondering if the @SecondaryTable annotation might do the trick? Here's an example:


Mapping One Class to Two Tables with Hibernate and JPA

 
reply
    Bookmark Topic Watch Topic
  • New Topic