-->
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.  [ 5 posts ] 
Author Message
 Post subject: how to use a property ONLY for insert statements??
PostPosted: Tue Aug 08, 2006 10:33 am 
Newbie

Joined: Mon May 29, 2006 5:23 am
Posts: 7
Hello,

I am currently facing an issue while trying to select some records out of a table. For insertion i have used some properties which not directly map with a column from a table, but i am using this property as a parameter in a stored procedure.

===
<property name="organizationId"/>
===

The problem is that while trying to select records from the database Hibernate expects a mapping to a column.

Does somebody know how i can tell hibernate that when i select something from the database, it should not get that property, so it will not throw an exception?

Please let me know.

Regards,
Martijn


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 10:46 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
If you don't want hibernate to fetch a property, then don't specify the property in the hbm.xml file?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 2:18 am 
Newbie

Joined: Mon May 29, 2006 5:23 am
Posts: 7
No, that's no option. Like i said, i am using the property as a parameter for a stored procedure which inserts data to my table.

Any other suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 3:48 am 
Newbie

Joined: Wed Jun 15, 2005 9:18 am
Posts: 11
Is organizationId a foreign key in your database ?

If it is, how about having a many to one relationship between your class (the one you try to map) and a class named 'Organization' which primary key is mapped to the organizationId column of the ORGANIZATION table in the database

So you can access the organizationId as follow :
myObject.getOrganization().getId()

In an object model, foreign key does not exists, only association does.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 3:57 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
Then maybe you should have a look at interceptors, especially the onload method. I suppose you could filter out unwanted properties there.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.