as I criptically point in my post, you can change the database-schema for
it; StringBuffer is another workaround, 
specially 'cause it implements Serializable.

however for many reasons I prefer to have Strings map to varchars (which,
let's remeber that, should grow as needed)
because it's persisted state is java-independant. It's kinda annoying
dumping the db and see a lotta hex codes where
I should read a String (not to mention, integrating to it without Java is
nearly impossible)

My 2c,

JP

-----Original Message-----
From: Randahl Fink Isaksen [mailto:[EMAIL PROTECTED]]
Sent: Jueves, 11 de Enero de 2001 7:27
To: Orion-Interest
Subject: RE: large field bug ??


Some thoughts...

You are right, that such a work-around would work, but having to keep your
Strings stored in memory as Objects i not very nice - can't the mapping be
changed, so Strings are mapped to Blobs...?

If not, I would use StringBuffer (which is probably mapped to BLOB) instead
of Object to store my Strings.


Randahl

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Juan Lorandi
(Chile)
Sent: 11. januar 2001 08:54
To: Orion-Interest
Subject: RE: large field bug ??


had that problem....

it's a mapping problem... (oracle-schema)


Strings get Mapped to varchars(size)...

They get chopped at size chars...
the only solution is to declare the field as java.lang.Object
then use it as string

public Object name;

public void setName(String name)
{
        this.name = name;
}
public String getName()
{
        return name.toString();
        //or:
        //return (String) name;
}

HTH

JP

-----Original Message-----
From: Agus K. Pranantoseno [mailto:[EMAIL PROTECTED]]
Sent: Miércoles, 10 de Enero de 2001 22:21
To: Orion-Interest
Subject: large field bug ??


I have manage to put my String stored as blob working using cmp.... but if
the size is more than 1k it's go wrong... (the blob does not stored to the
db and the next time i restart the orion those entity even failed to
load)....
i am used orion 1.3.8 with oracle 8.1.6 both on linux machine....
is there any limitation in bean size ?? this is orion bug or oracle jdbc bug
???
i only done simply cmp mapping



--------------------------- THE SOURCE (if u don't mind to
read) ------------------------
public class MediaEJB implements EntityBean {
 transient EntityContext context;

 public int id;
 public MediaFolder folder;
 public String name;
 public Object content;

 public Integer ejbCreate(MediaFolder folder,String name) throws
CreateException {
  try {
   this.id = (int) CounterUtils.getNextID("java:comp/env/ejb/Counter",
"MediaFolder");
  } catch (Exception ex) {
   throw new CreateException("Unable to genereate auto number "+ex);
  }
  try {
   setFolder(folder);
  } catch (Exception ex) {
   throw new CreateException("Error "+ex);
  }
  setName(name);
  return null;
 }
 public void ejbPostCreate(MediaFolder folder,String name) {
 }

 public MediaFolder getFolder() {
  return folder;
 }
 public void setFolder(MediaFolder folder) throws EJBException,
RemoteException {
  MediaFolder itr = folder;
  while (itr != null) {
   if (itr.getId() == id) throw new EJBException("Recursif folder");
   itr = itr.getParent();
  }
  this.folder = folder;
 }

 public int getId() {
  return id;
 }

 public String getName() {
  return name;
 }
 public void setName(String name) throws EJBException {
  if (name == null) throw new EJBException("Parameter name is required");
  if (name.length() == 0) throw new EJBException("Parameter name is
required");
  this.name = name;
 }

 public Object getContent() {
  return content;
 }
 public void setContent(Object content) throws EJBException {
  this.content = content;
 }

 public int getLevel() throws RemoteException {
  if (folder != null) return folder.getLevel() + 1;
  return 1;
 }
 public String getFullName() throws RemoteException {
  if (folder != null) return folder.getFullName() + "/" + getName();
  return getName();
 }
 public String getFullName(String separator) throws RemoteException {
  if (folder != null) return folder.getFullName() + separator + getName();
  return getName();
 }





 public void setEntityContext(EntityContext context) {
  this.context = context;
 }
 public void unsetEntityContext() {
  context = null;
 }

 public void ejbActivate() {
 }
 public void ejbPassivate() {
 }
 public void ejbLoad() {
 }
 public void ejbStore() {
 }
 public void ejbRemove() {
 }
}
----------------------------------------------------------------------------
-----------

----- Original Message -----
From: Tobias Streckel <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: Thursday, November 30, 2000 3:02 PM
Subject: Re: How can I use an BLOB datatype


Hello again,

my prog. is very easy. I'm only have a String (contain a big Text) and I
will it save on a colmn (Oracle DB) with a BLOB.

Thanks

Tobi

-----Ursprüngliche Nachricht-----
Von: Tim Endres <[EMAIL PROTECTED]>
An: Orion-Interest <[EMAIL PROTECTED]>
Datum: Donnerstag, 30. November 2000 07:10
Betreff: RE: How can I use an BLOB datatype


>Gernalizing this one step further. We have a situation where
>we want to place large ( larger than 10MB ) into the DB. Thus,
>when I get or store I would really like to have an InputStream
>or OutputStream to read or write the "object". However, it does
>not appear that EJB really supports this. Has anyone build an
>entity bean (or session for that matter) that can stream large
>amounts of data into and out of the database? How?
>
>Thanks,
>tim.
>
>> In CMP, the output streams should be created for you.
>> The database config xml file should provide a mapping
>> of a Serializable object to a BLOB/Image/etc.  If
>> this is done, the object will be serialized before
>> insertion automatically.
>>
>> -tim
>>
>
>







Reply via email to