-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: mapping problems
PostPosted: Mon Sep 05, 2005 7:00 am 
Newbie

Joined: Mon Sep 05, 2005 6:44 am
Posts: 1
Location: Chennai
Hi,

I am a newbie for the hibernate and the OR mapping, and currently i am having a problem with mapping the Table to the Object.

We are having a scenario, where we store the Type and the Date (Key, Value) pair in the table, with the designed table structure and i wanted to know how this can be mapped with the Hibernate?

i gone thru many mapping documents and the code samples, and i came out withthe Composite Key option, one and the other is the Set mappings.

But i am having problem with both the stuffs and if any one have solved the issue earlier, it would be much more helpful in my case.

Let me give some sample here,

Though this is not the exact thing, i am trying to show the problem with this example,

Take case of Auditing function, i want to store the Type of action takes place, by what means the action taken place and the object on which the action takes place.

Consider the table structure is,

AuditId int (PK)
ActionType varchar(100)
ActionUserType varchar(10)
ActionBy int(10)
ObjectType varchar(10)
ObjectId int(10)

ActionUserType - This field will hold 'System' or 'User' value. where as , if the user makes the action, this will be 'User' and if it happens because of any System operations, this will have the value 'System'.

ActionBy - this will hold the id of the user whom made the action, incase if the ActionUserType is User, otherwise 0 to it.

Sameway, ObjectType, will hold the type of object on which the action is happened and ObjectId is the id of that object. For example, in a discussion forum, i can have either topics or messages. So i want to differentiate, Topic actions and message actions. So this will do.

Hope, this example could have explained the scenario and the problem and i would like to know how this can be solved using the mappings.

Thanks & Regards,

Deiva


Top
 Profile  
 
 Post subject: Re: mapping problems
PostPosted: Mon Sep 05, 2005 8:34 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Have you tried to do this on your own and received errors ?

You'll find a lot better response if you make an effort on your own.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.