table 2 « Map « JPA Q&A





1. Mapping same class to many tables    forum.hibernate.org

Hi all, My application uses the same class in two different contexts and needs to be persisted in different tables depending on the context. Here is a more precise idea: public class CommonObject { // ... } public class Context1 { private List commons = new LinkedList(); // ... } public class Context2 { private List commons = new LinkedList(); // ...

2. Is it possible to map in Hibernate following table?    forum.hibernate.org

We have tables where historical data are stored together with up-to-date data. If data are historical they have column ST set to 1, if they are up-do-date they are set to 0. Primary key consists of columns DV and PM. DV is unique id of a row in a table and PM is unique id of an entity. Only one row ...

3. Is a map for only 1 table too simple? Is is possible?    forum.hibernate.org

If each A can have several Bs, I have no problem defining a one-to-many map that gives me the map of Bs, in A's hbm.xml. However, I can't figure out, if I _only_ have a table of Bs, how to define a map in B's hbm.xm, of all the B'sl. That is, I want a way to fetch a map of ...

4. How to map multiple tables to one class    forum.hibernate.org

5. Refactoring and mapping an existing table    forum.hibernate.org

hello, I have to rework an application, so database tables are already existing. I need some advice on a refactoring. As the business/domain objects was linked by their database identifiants ( in best case, sometime there's no link although there's a relationship ), i need to add some reference to the convenient objects. i have to deal with 3 tables. The ...

6. mapping multiple tables using another table    forum.hibernate.org

I am mapping 3 many-to-many relationships with a common table. I've been trying to get this to map, but am not sure it is possible. If anyone knows of a way to handle this complex mapping, I'd greatly appreciate help. I have the following table structures simplified to their primary keys: TableA: col1 TableB: col2 TableC: col3 col4 TableD: col1 col2 ...

7. Two maps in one table    forum.hibernate.org

Are the two maps going to have the same set of keys? If you're going to end up with identical sets of keys, then I think what you want to do is to add one map with both columns in your hibernate mapping, then use that map to back two "virtual" maps in your java object. This will reduce the number ...

8. mapping 3 tables    forum.hibernate.org

Hello, I am trying to map 3 tables. people positions position status. position has a foreign key to both people and positions status. The mappings are fine when i select just from 2 tables. But when i try to select status for a position for a cretin person i get all the positions with where position status= to the pos for ...

9. Can 3 class map on 1 table?    forum.hibernate.org

steckemetz wrote: Perhaps you can use component mapping ? See chapter 5.1.13. I know component cannot have OID, but there is 3 individual businesses based on 1 table. for example, a "Customer" table with many fields. the login system only needs fields: ID, username, password. the shoping system only needs fields: ID, truename, address, zipcode. the email system only needs fields: ...





10. Mapping multiple tables to single class    forum.hibernate.org

Hello I am a new user to hibernate like many and I wanted to ensure that I have an understanding of Hibernate 3's functionality with respect to mapping multiple tables to a single class. Essentially, what I want to do is have a generic property class that stores a name/value pair along with several property attributes (i.e. default, timestamp, etc.) I ...

11. Multiple Tables Mapping    forum.hibernate.org

12. Mapping a class to a lookup table    forum.hibernate.org

Hibernate version: 3.1 I have a class called RecordStatus with the following attributes Code: public class RecordStatus { private Long id; private String status; private String statusDescription; private String statusReason; private String statusReasonDescription; private Date statusDate; } I have a legacy table called ...

13. Mapping 2 classes to one table.    forum.hibernate.org

Caused by: java.sql.SQLException: ORA-00904: "SHORTSYSTE0_"."DTYPE": invalid identifier at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289) at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582) at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986) at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:880) at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2516) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:537) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at ...

14. Mapping issue - more tables than classes    forum.hibernate.org

Hi! I tried to get an answer at several locations, so I think I have to spend a credit to get an answer here...maybe ;-). Well, suggest I want to model a letterhead. In Java I would generate a class like: class Letterhead { private String title; private String address; [Mr. or Mrs.] private String name; private String surname; ....gettter/setter.... } ...

15. Mapping class to Table    forum.hibernate.org

Mapping documents: com.sybase.jdbc2.jdbc.SybDriver jdbc:sybase:Tds:dems1op.de.office.aol.com:5015 user password 10 true org.hibernate.dialect.SybaseDialect update

16. Mapping a class with several tables    forum.hibernate.org





17. Mapping Multiple Tables to One Class    forum.hibernate.org

Thanks in advance for your help. I am attempting to map data from multiple tables into a single class. Here is the table setup: Table Foo column a (pk) column b Table Bar column a (pk) column c (pk) column d column e There is a one-to-many relationship between Foo and Bar. I have a class that stores values for a, ...

18. Mapping two classes to the same table    forum.hibernate.org

Hi all, I am finding it difficult to map two different classes (ClassA and ClassB) to different columns in the same table. Both classes share the same composite id, as shown below. Code: public class CompositeId { public long compositeLong; public String compositeString; } public abstract class BaseClass { public CompositeId id; ...

19. How to map multiple classes to same table    forum.hibernate.org

20. 1 Class mapping to 2 tables    forum.hibernate.org

Here's the problem. We have a webapp in which we can enter data (Timesheets), no problem there. When the user is finished he saves the timesheet in our database. Afterwards he can change the timesheet etc. When he is really finished he submits his timesheet and then the timesheet needs approval of his supervisor. However no the problem occurs when the ...

21. Table maps back to itself?    forum.hibernate.org

22. How map three tables on two classes?    forum.hibernate.org

I'm novice in hibernate and i have a little problem with mapping. I have three tables: CREATE TABLE USER ( ID NUMBER NOT NULL, LOGIN VARCHAR2(20) NOT NULL, PASSWORD VARCHAR2(128) NOT NULL, FULLNAME VARCHAR2(128) NULL, ); CREATE TABLE PROFILE ( ID NUMBER NOT NULL, PROFILE_NAME VARCHAR2(64) NULL ); CREATE TABLE USER_PROFILE ( USER_ID NUMBER NOT NULL, PROFILE_ID NUMBER NOT NULL ); ...

23. Mapping 3 times the same table with many-to-one - problem    forum.hibernate.org

Author Message jmdelsaux Post subject: Mapping 3 times the same table with many-to-one - problem Posted: Wed Aug 16, 2006 10:57 am Newbie Joined: Sun Apr 24, 2005 4:34 pm Posts: 5 I try to map 3 times the same table with a many-to-one relation ship. Code:

24. mapping two tables not working    forum.hibernate.org

25. Mapping without link table    forum.hibernate.org

If you wish to represent a many-to-many association in a relational database, you must introduce a new table, called a link table. This table doesnt appear anywhere in the object model. For our example, if we consider the relationship between a user and the users billing information to be many-to-many, the link table is defined as follows: CREATE TABLE USER_BILLING_DETAILS ( ...

26. How to create 2 's to the same table    forum.hibernate.org

Senior Joined: Sun Jun 11, 2006 10:41 am Posts: 164 Hi all, Can someone have a look at the mapping below and see if there anything wrong? I have the following object model: Device: base for any type of device Terminal1, Terminal2: subclasses of Device Manager: holds 2 maps - map1 for Terminal1s and map2 for Terminal2's, so it's a one-to-many ...

27. Trouble with hib map: linkin through n:m table    forum.hibernate.org

Hello, i got next trouble. Where my MYSQL schema struct was : --- Maps: idMap name Cells: idCell name Cells_on_Maps: idMap (foreigen -> maps) idCell (foreigen -> cells) Key --- my mapping docs looks like ---

28. table mapping problems    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Please need help badly. Thanks in advance I have 2 small classes: using map in association. ================= public class Data { private long dataId; private String name; private Date times; private Map properties = new HashMap(); } public class VarValue { private long varId; private String key;//key of the ...

29. One mapping two sets of tables...    forum.hibernate.org

Hi, We have two sets of similar tables in the database distinguished by a prefix for the table name. One set represents final data and the other set represents temporary data. Other than the conceptual difference (final and temp) both the sets are very similar distinguished by a prefix for temp table names. In such scenario, what would be the best ...

30. One Class/Mapping - Multiple Tables    forum.hibernate.org

Here's the solution: Code: /********************************************** * Initialize Spring/Hibernate SessionFactory * **********************************************/ Cw1SpringDao dao = SpringRegistry.getCw1Dao(); .... /*********************************************** * Build Hibernate Configuration manually * * ...

31. AS400 - Table Mapping per Library?    forum.hibernate.org

32. table mapping    forum.hibernate.org

Hi all, im new to this forum and also for using hibernate. i hope i can find answers from the experts here. i'm solving this problem 2 days now and i haven't found the cause yet. the situation is: i have an employee which is the parent and employeetimesheet is the child. now when i inserted data to both tables the ...

34. How to map two unrelated tables    forum.hibernate.org

Hi guys, i'm facing a problem since 2 weeks. I've two tables which have no relationship between them. Table Account_Master(AccountNumber, MarketId, AccountType) where AccountNumber and MarketId are composite keys. Table Call_Reason(AccountNumber, CallDate, CallReason, CallDesc) where AccountNumber and CallDate are composite keys. I want to map a relationship between these tables based on AccountNumber. Here are the mapping files. Account_Master hbm file: ...

35. Link Table Mapping Question -- Newbie    forum.hibernate.org

Hi All, I am having trouble mapping 2 tables via a link table. I am a newbie to this, so please be gentle -- and basic. I have 3 tables: SITE_REF, where the PK is site_id NETWORK_REF, where the PK is network_id and SITE_NETWORK_REF, where the PK and FK are site_id and network_id As far as cardinality, I came up with ...

36. table is not mapped    forum.hibernate.org

Newbie Joined: Mon Dec 18, 2006 1:39 am Posts: 1 I have a very strange problem for me but may very simple for you guys. I created tables using ant task schemaexport and loaded some data. I am sure the table and data was there because I can see them from HSQLDM. but when I tried to load it from my ...

37. Can Hibernate create tables from mappings?    forum.hibernate.org

38. map one class to different tables    forum.hibernate.org

39. Bi-directional mapping problems while creating tables on run    forum.hibernate.org

Hi, I have tables with many-many relationship mapping and they are bidirectional. I am writing junits using spring mock,DBUnit and HSQL. All the tables are created on the fly using hibernate's HBM2DDL option. when table 'student' is getting created, i am getting exception saying table 'student_course' doesnt exist. I tried to move around the order of tables creation , but nothing ...

40. Single table per class hierarch mapping.    forum.hibernate.org

Guys, was trying to use single table per class hierarchy; originally had one class Order per table (Orders); everything was working great; then tried to introduce child class OptionOrder and failed with mapping. What might be wrong? Thank you in advance, Caesar Hibernate version: 3.1 Mapping documents:

41. Problem with two classes mapped to the same table    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1.3 I have two classes: First class:

42. mapping with 3 tables    forum.hibernate.org

Hi All, I am new to hibernate I am working for a security project which is being developed in Spring and Hibernate. In this project a new request will be created when a new employ joins the organization. This request will contain information to different office sites and floor areas within the sites. I need to store this information in the ...

43. Transparent Lookup tables mapping    forum.hibernate.org

I'm new at hibernate so this question might be very trivial :) I don't know how to make the lookup table transparent in my code; I mean if I have a lookup table Status (married, single,...), and there is person table which has an Integer field for status Person (ID, Name,...,status(foriegn key)) how can in my Person class have status as ...

45. Multiple Table mapping to Same Java Class    forum.hibernate.org

Hi, I am new to Hibernate, and would like to know how a java model class can be mapped to different database tables in Hibernate. I have the following scenario: I have a java class A, which is used in different contexts as below. In certain cases, A will appear as aggregation composition to class B. i.e., B -> A* and ...

46. Not sure on how to map two tables.    forum.hibernate.org

God, I'm getting a headache; since users table is the "one" side of the relationship, shouldn't a one-to-many relationship in the Users hbm be putted?, instead of a many-to-one in the messages ("many" side) in the messages hbm?. In my object's model, the user pojo contains a set of sent messages and another for received messages, or am I getting the ...

47. how to map many class to one table?    forum.hibernate.org

48. 1 class, 2 tables, some conditions... mapping.    forum.hibernate.org

i forgot something in the Stops database table: Stops: -stopid <----- -code -thing ... can anyone tell me if this mapping will do the trick??? Code:

51. One Class mapped to Two Tables    forum.hibernate.org

I have a problem, is there a solution in hibernate where we can map one class to two tables...if i do so it gives me an error..same class ,mapped to two different tables...is there any solution for this kind of situation.if so please give me an example how to specify it in the mapping file. Thank you.

52. Mapping 3 tables in hiberante    forum.hibernate.org

Hello, I have Person table having person_id,name. Event table having event_id,name. Order table having order_id,name. I have a table Per_Eve table having person_id,event_id. This works fine using bi-directional association The problem is when i want the below scenarion I have a table Per_Eve_Ord table which has person_id,event_id,order_id. How do i associate these table using hibernate mapping? Any help is appreciated

53. Mapping one class to 2 different tables    forum.hibernate.org

54. Don't know how to map a table.    forum.hibernate.org

Hibernate version: 3 Databese MySql I'm having trouble creating mapping file for one of the tables. Relation is one-to-many but the key is multicolumn: The tables are as following: CREATE TABLE item (model_id INTEGER, item_id INTEGER NOT NULL AUTO_INCREMENT, type_id INTEGER NOT NULL, item_name VARCHAR(100), item_pic VARCHAR(60), size_type VARCHAR(5), item_desc TEXT, PRIMARY KEY (item_id), KEY (type_id), KEY (model_id)) ; ALTER TABLE ...

55. One to Many mapping using two link tables    forum.hibernate.org

Hibernate version: Actually using NHibernate 1.2.0 GA but asking the question here as it pertains to the mapping file as opposed to the underlying language. I have a table of Portfolios. A Portfolio can contain many trades. However for various reasons I have to do this through two link tables. Portfolio 1.... * PortfoliosTrades 1....1 TradeExternalMap 1...1 Trades I just want ...

56. Mapping with existing table    forum.hibernate.org

I'm creating a new Class for which I'm using hibernate to persist. However, it is dependent on an already existing table in the DB (which does not use hibernate). To be more concrete: Table: DEVICE (dev_id long, name varchar ....) : This is existing table. Table: DATA (dev_id long, key long, value text) : This is my table. The class for ...

57. DynamicMode MAP - Link table    forum.hibernate.org

Hi, I am struggling with the hibernate mapping for a mapping between two tables using a link table. I have the following tables: customer - customer_key, forename, surname, email card - card_key, card_number, valid_from, expiries customer-card - customer_card_key, customer_key, card_key My mapping file is:

58. mapping problem with table in Hibernate    forum.hibernate.org

hello friends, In am getting an error while retreiving a record from Database. Can any one tel me where i am doing mistake. Code: org.hibernate.hql.ast.QuerySyntaxException: emp is not mapped [select pwd from emp where uid='aaaaaaaa'] here emp is my table name the mapping is as follows.. Code:

59. How to avoid creating mapping table??    forum.hibernate.org

In the hibernate configuration, there is this property: update in the actual mapping configuration, we have a class definition: where ThreeStrings is just a custom Java class. What I notice is in the database, a temporary table "ThreeStrings" always gets created (if not exist) when the Hiberate sessionFactory instanticate. While all ...

60. History Table Mapping Question    forum.hibernate.org

61. Mapping one class to multiple tables    forum.hibernate.org

Newbie Joined: Fri Dec 07, 2007 5:02 am Posts: 4 Location: Haugesund, Norway Hi. I need some help on this one. I'm trying to migrate an old Lotus Notes app into some java, and came across a problem. In general, I have this sql which I want to convert to a hbm... Should be a breeze, I thought. But the join ...

62. How To Use Hibernate to Create Tables without mappings    forum.hibernate.org

Is it possible to use hibernate to generate table structures from java code? i want a generic way of building tables across different databases without the need of having different SQL templates to do so. Since hibernate creates its own table structures would this be possible to do in java code if so some pointers would be much appreciated. Thank You ...

63. How to create mapping btwn 3 tables    forum.hibernate.org

Hi I am new to Hibernate and JPA. I have one project requirement where I have to create mapping between 3 different tables. For example I have HD_TB table, ST_TB table and TC_TB table now All 3 tables has many to many relationship with each other. I want to create relation between all this 3 table in one table. I mean ...

64. How do I map one class to separate tables ?    forum.hibernate.org

To improve performance, I have two classes that are the same in every way but used in completely different scenarios, so I would like to split the tables for faster querying. However I'm not sure how this works using Spring's Hibernate Template. So two questions, 1) Is entity names what I should be looking at to split them, 2) How can ...

65. Mapping two classes to same table?    forum.hibernate.org

Is there anything wrong about having two Java classes mapped to the same table? I have an entity (e.g. course) that has a number of related sub entities (e.g. attendees, class times etc) but I don't want to include these sub entities as properties in the main entity class structure. To get around this I'm using the following class hierarchy... Code: ...

66. Mapping one table to two different classes    forum.hibernate.org

67. Must all my tables be mapped by Hibernate    forum.hibernate.org

I have several tables that are not persistent(not entity objects) tables, they are populated by another system and their only use is to join on and get data from. Do I need to register these tables with Hibernate in any way? Can I just use HQL or createQuery() or Criterion to join on these non-entity/non-component tables, thanks guys.

68. Mapping a tree within one table    forum.hibernate.org

@Entity public class Category { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "category_id") private Long categoryId; //primary key @Column(name = "name") private String categoryName; @Column(name = "parent_category_id") private Long parentCategoryId; @???? private Category parentCategory; @???? private List childCategories; ...

69. Mapping of the table    forum.hibernate.org

70. mapping multiple classes to one table    forum.hibernate.org

Hibernate version: 3.2 Is it possible to map two classes to a single table in the database? We have two classes that have two variables each. We would like to combine the data into a single table. We want to keep the two classes separate because they are modeling an XML doc. Is there any way of doing this without combining ...

72. MapKey not working with table_per_class mapping    forum.hibernate.org

Author Message marvinvs Post subject: MapKey not working with table_per_class mapping Posted: Wed Jun 04, 2008 2:47 pm Newbie Joined: Thu Feb 16, 2006 8:45 am Posts: 1 Location: Cape Town, South Africa Hi, I would really appreciate any help on this problem: I have a abstract class, say ClassA, defined as follows: Code: @Entity @Inheritance(strategy=TABLE_PER_CLASS) public abstract class ...

73. Multiple many to many mappings sharing one table.    forum.hibernate.org

I have "Assessment", "Attachment" and "Control" tables. Assessment and Attachment are many to many with a join table. Same with Control and Attachment are many to many with a join table. To minimize the manual insert/delete, I am using cascade="all-delete-orphan". If I have a attachment, say doc1, linked to both assessment and control. How do I remove the link between Assessment ...

74. Table Mapping    forum.hibernate.org

I am very new to Hibernate. I am currently having problems creating a mapping between two tables (a link table and another table). I have a table A that contains a primary key and four other properties such as name, date, etc. And, it is link to a link table that contains the primary key from table A along with 5 ...

75. Very simple Table not Mapped Problem    forum.hibernate.org

Using JPA-Hibernate ORM.XML com.datesite.user

Entity Manager @Repository @Transactional public class EntityManagerDateUser implements DateUserManagerI, Serializable { private EntityManager em; public EntityManagerDateUser() { } @PersistenceContext public void setEntityManager(EntityManager entityManager) ...

76. One-To-Many Mapping - 3 Tables    forum.hibernate.org

Hi, how best should i do that? I have 3 Tables. Item, CompItem and Price. One Item can have many Prices, One Item can have many CompItems and one CompItem can have many Prices. so, i want to have a method with the parameter ItemId. And i want to get back all Prices of that Item and also all Prices of ...

77. Mapping one class to a set of Tables - possible?    forum.hibernate.org

78. Mapping class to multiple tables    forum.hibernate.org

Hi, we have an existing java application which is persisting data to a oracle database using jdbc. I am working on converting the application to use hibernate. application has class structure similar to sample below class A { private String id; private int version; private String dataA1; private D d; ..... } class B { private String dataB1; ....... } class ...

80. Having a big table to mapping    forum.hibernate.org

81. Handling mapping tables    forum.hibernate.org

82. Two classes mapping to same Table.    forum.hibernate.org

Is it possible to map two classes to the same table? For example: I have a table EMPLOYEE with columns: id, name, address1, address2, city, state, employername, employeraddress, salary What I did was: I made two mapping files: employee.hbm.xml and address.hbm.xml. employee.hbm.xml maps to EMPLOYEE table with id, name, employername, employeraddress, salary (class name: Employee) address.hbm.xml maps to EMPLOYEE table with ...

83. Mapping across multiple tables    forum.hibernate.org

Hi, Just looking for a bit of advice on the best approach here. My Employee class contains a reference to another manager Employee and a Department class. Both the Employee and Department classes are already mapped. Due to performance reasons I'm looking to create a new class to retrieve only the attributes that I require. These include the manager's name and ...

84. Map two sets to same table?    forum.hibernate.org

I'm unclear on how to create the mappings for a situation. This is not my exact use case, but is a simplified illustration of what I'm trying to do: I have a Dog entity that contains an id and name property. I have a Breeder entity that contains a set of Dogs. These are the Dogs that the Breeder owns. Now, ...

85. Mapping a class to different tables    forum.hibernate.org

Hi, I have following modeling problem: I have a java class, let's name it "class A", with 3 attributes (attr1, attr2 and attr3). This class is represented by 2 tables in the database: tableX and tableY. TableX and TableY have each 3 fields. TableX has field1X, field2X and field3X. TableY has field1Y, field2Y and field3Y. I'd like to have class A ...

86. is it must to have a seperate table for a map in a class??    forum.hibernate.org

hi, I have class A which has object of class B in it. Class B just has a map. I want to map above by using 2 tables. 1 for Class A and the other for map. I want to skip table for B as it doesn't have any attributes other than map. I have one-to-one mapping between A and B. ...

87. Linked table mapping?    forum.hibernate.org

88. One Class Two Tables Mapping    forum.hibernate.org

I have a class which maps to two tables. I utilized the reference to configure but the configuration does not match with my class. Would you help me the correct configuration, please? EmployeeDetail.java Code: public class EmployeeDetail implements Serializable { private static final long serialVersionUID = 1L; private String staffId; ...

89. Is a mapping table always needed?    forum.hibernate.org

Hi! I'm quite new to using hibernate, so be gentle. I'm setting up a rule engine, which handles lists that are defined by a set of rules. The engine should, given a list id, return a list of detailed rules for that list. A list is only defined by its list id, it has no extra properties. A rule has a ...

90. Mapping tables to classes or classes to tables?    forum.hibernate.org

Hello, I am a newbie in Hibernate concepts. I want to build my system using JPA+Hibernate, my question is: What is the best approach, mapping from tables to classes or vice versa? In other projects in which I have worked , database script was already created, for that reason I mapped from tables to objects, but in this case there isnt ...

91. Uni-Directional one-To-Many mapping from Table A to B    forum.hibernate.org

Hi Everybody, I have difficulty in Mapping Table A with Table B where B has a composite key I want to do 1-To-Many mapping from A->B. Example:- Class A{ //custId is primary key of Table A Integer custId; //Do join with custId of Table A with custId of Table B. List listB; } Class B{ //composite key comprises of 4 keys ...

92. Mapping tables to classes or classes to tables?    forum.hibernate.org

Hello, I am a newbie in Hibernate concepts. I want to build my system using JPA+Hibernate, my question is: What is the best approach, mapping from tables to classes or vice versa? In other projects in which I have worked , database script was already created, for that reason I mapped from tables to objects, but in this case there isnt ...

93. Hibernate Mapping (4 tables)    forum.hibernate.org