I am new to hibernate and i want to map a table having only foreign keys using xml file. I have 3 tables 1.UserInfo(for user details with a primary key) 2.AuthorInfo(containing author details with a primary key) 3.AuthorFollow(to map which user is following which author). The AuthorFollow table contains only 2 columns UserId and AuthorId both are having relationships(foreign keys) with the 1st 2 tables respectively. I haven't given any index on these columns.
I have written below code in AuthorFollow.hbm.xml
But, its not working properly.
<?xml version='1.0' encoding='utf-8'?>
<composite-id>
<key-many-to-one name="userId" column="user_id" class="com.pojo.hibernate.UserInfo" />
<key-many-to-one name="authorId" column="author_id" class="com.pojo.hibernate.AuthorInfo" />
</composite-id>
</class>
(i have used mysql.)
And, is the table structure proper?