-->
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.  [ 4 posts ] 
Author Message
 Post subject: [NOOB] Spliting properties to different tables
PostPosted: Thu Nov 23, 2006 6:59 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
Hi,

I am trying to map a class that has string property. Ok, so far so good. ;) The problem is, that due SQL server restrictions i have to put some long texts in an extra table.
What I now want to do is to map this that way, so i can access the text directly, like
Code:
myClass.getText()


Here how the tables e.g. may look like.
Code:
__________________     __________________
| tblMyClass     |     | tblText        |
------------------     ------------------
| ...            | |-> | textid   (int) |
| textid   (int) |-|   | text (varchar) |
| ...            |     | ...            |
------------------     ------------------


And here an example class:
Code:
class myClass
{
    ...
    private String text;
    ...
    public String getText()
    { ...}
    public String setText(String text)
    { ... }
}


Is this possible or I am totaly wrong?

Best

eg


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 8:42 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
of course you can, just use joined classes (@secondaryTable annotation or joined tag in mappings).

by the way you can use a CLOB and mark it to be lazy-fetched, (so it can be in the same table as your entity)

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 10:22 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
Hi pash,
thanks for your answer, but

pasha wrote:
of course you can, just use joined classes (@secondaryTable annotation or joined tag in mappings).

I thought this is only for a subclass. But I want to use it as a property, only that the property is not located in the same table.
Did I get something wrong?

pasha wrote:
by the way you can use a CLOB and mark it to be lazy-fetched, (so it can be in the same table as your entity)

Good Idea but AFAIK, you cannot do any search (e.g. "like", etc.) on CLOBS. But I need to keep this abillity.

Thanks

eg


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 24, 2006 5:27 am 
Beginner
Beginner

Joined: Fri Dec 23, 2005 6:05 am
Posts: 42
C'mon! Is this really that hard? I thought it to be an easy one.


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