-->
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: how to Declare a java String of more than 5000000 characters
PostPosted: Thu Mar 30, 2006 8:42 am 
Newbie

Joined: Sat Jan 14, 2006 12:44 pm
Posts: 2
Hi,
Iam Using Hibernate 3 and PostgreSQL 8.1 as backend.
I have written a class in java in which i have declared
public String PhaseDescription = "";

The above line will create a feild in the Database table.
It is creating a feild of length 255 only.
How do i declare the below given declaration to create a feild of 500000 characters
public String PhaseDescription = new String();


Here is my class
@Entity(access = AccessType.FIELD)
@Table(name = "Phase")
public class Phase {

@Id
public String PhaseID = "";

public String PhaseName = "";

public String PhaseCode = "";

public String PhaseDescription = new String();

public String EntryCriteria = "";

public String ExitCriteria = "";

}

Please help me


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 9:57 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Are you using mapping files or annotations? Not sure how to do it using annotations, but the mapping file version is
Code:
<property name="PhaseDescription" type="clob" length="500000"/>
You might be able to use a varchar, but I doubt it, I don't think any DB server allows that much space for one in-row field. You could also use type="text", I think that's equivalent to a clob, can't say for sure, though.

Note that there are all sorts of special rules for dealing with lobs, and things like them. You'll have to read up on that in your DB documentations, but basically it's because the data aren't stored directly in the row with the other values, they're stored elsewhere, and the row just contains a pointer to the data.


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.