Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 149287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:06:25+00:00 2026-05-11T09:06:25+00:00

Hello Stack Overflow Experts, i have need of your expertice: I am trying to

  • 0

Hello Stack Overflow Experts, i have need of your expertice:

I am trying to use Hibernate on an Existing DB. Currently im trying to load a User object and a list of UserData objects that go along.

in the DB the (simplified) layout is

|    User      |      |          UserData               | ----------------      ----------------------------------- uid | username |      | uid | parentuid | field | value |  

So each User object matches all the UserData objects where UserData.parentuid = User.uid.

My User class mapping file

    <class name='com.agetor.commons.security.User' table='ac_users'>     <id name='uid' column='uid' type='long' >         <!--<generator class='native'/>-->     </id>     <property name='username' column='username' />         <list name='fieldData' cascade='all'>         <key column='parentuid' not-null='true' />         <index column='parentuid' />         <one-to-many class='com.agetor.commons.fields.FieldData'/>     </list>  </class>  

Mu UserData mapping file

    <class name='com.agetor.commons.fields.FieldData' table='ac_userdef_data'>     <id name='uid' column='uid' type='long' >     <!--<generator class='native'/> -->     </id>     <!--<property name='parentuid' column='parentuid' />   -->     <property name='fieldname' column='fieldname' />     <property name='value' column='value' /> </class> 

So far i have tried many different configurations and all of them have had various degrees of failue. The code pasted here, does not work.

  • The parentuid property is commented out, because Hibernate gives a ‘Repeated column in mapping’ error otherwise.
  • Currently there is still a ‘Repeated column in mapping’ on the uid field, i use for <list-index />
  • I do not understand where i specify that UserData.parentuid is the foreign key and that the list should use User.uid as key.

I hope someone is able to help.


When you define both a One-To-Many and a Many-To-One, does this not make it Bi-Directional? The current working model, is Unidirectional and UserData does not have a reference to User. Your suggestion fails, because Hibernate could not find a get or set method for User on UserData.

Is it implied that, this code uses User.uid as a key and matches this against the UserData.parentuid column? Or is this fact specified somewhere else?

  <list name='fieldData' inverse='true'>     <key column='parentuid' not-null='true' />     <one-to-many class='com.agetor.commons.fields.FieldData'/>   </list> 

I am still learning Hibernate and working my way through documentation and examples i can find.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:06:25+00:00Added an answer on May 11, 2026 at 9:06 am

    This is the latest development on this problem. This configuration can succesfully load from the Database. Saving does not work. I have decided to alter the Database design instead, so im posting this here for reference for others, before i abandon this approach.

        <class name='com.agetor.commons.security.User' table='ac_users'>     <id name='uid' column='uid' type='long' >         <generator class='increment'/>     </id>     <property name='deleted' column='deleted' />     <property name='username' column='username' />        <property name='password' column='passwd' />     <property name='disabled' column='disabled' />     <property name='lockout' column='lockout' />     <property name='expires' column='expires' />     <bag name='fieldData' lazy='extra'>         <key column='parentuid' not-null='true' />         <one-to-many class='com.agetor.commons.fields.FieldData'/>     </bag>     <bag name='groups' table='ac_group_rel' access='field' lazy='extra'>         <key column='useruid'/>                  <many-to-many column='groupuid' class='com.agetor.commons.security.Group'/>     </bag>              <join table='ac_userdef_data' optional='true' fetch='join'>         <subselect>             select                 *             from                 ac_userdef_data data             where                 data.objectname = 'user' and                 data.fieldname = 'firstname'         </subselect>         <key column='parentuid' />         <property name='firstname' formula='(select data.value from ac_userdef_data data where data.fieldname = 'firstname' and data.uid = uid)'/>     </join>     <join table='ac_userdef_data' optional='true' fetch='join'>         <subselect>             select                 *             from                 ac_userdef_data data             where                 data.objectname = 'user' and                 data.fieldname = 'lastname'         </subselect>                 <key column='parentuid' />         <property name='lastname' formula='(select data.value from ac_userdef_data data where data.fieldname = 'lastname' and data.uid = uid)'/>     </join>  </class> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello stack overflow I need help with this problem. Ok, I have a flat
Hello there people of stack overflow, I have just started developing with android and
Hello everyone this is my first post on stack overflow.com I am trying to
Hello good Stack Overflow people, I do have a business problem and would like
Hello good people of Stack Overflow, I have come with yet another question for
Hello Stack Overflow i hope you are well today, I have this code: $('.add_child').click(function(){
Hello Stack Overflow i hope you are well today; I have a form that
I'm trying to construct the following div element using jQuery: <div> <p>Hello</p> <p>Stack Overflow</p>
Hello Stack Overflow users, I have a fun problem that I have in my
Hello there Stack Overflow, I hope you'll help me with my very first question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.