-->
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: Bytea and OID datatype in posgres help
PostPosted: Mon Aug 18, 2008 3:29 am 
Newbie

Joined: Wed Aug 13, 2008 10:49 am
Posts: 1
I am using jboss seam …and richfaces .. for file upload..

I used bytea for storing image into daatabase … in postgres 8.3
I got exception

is of type bytea but expression is of type Integer…
Then i change to OID datatype same as bolb in oracle…. .

This is my java class :

private byte[] brandingLogo;

@Column(name = “branding_logo” ;)
@Lob
public byte[] getBrandingLogo() {
return this.brandingLogo;
}

public void setBrandingLogo(byte[] brandingLogo) {
this.brandingLogo = brandingLogo;
}

public void fileUploadListener(UploadEvent event) throws Exception{

upload = event.getUploadItem();
if (upload.isTempFile()) {
file = upload.getFile();
} else {
ByteArrayOutputStream b = new ByteArrayOutputStream();
b.write(upload.getData());
}
}

public UploadItem getUpload() {
return upload;
}

public void setUpload(UploadItem upload) {
this.upload = upload;
}

public File getFile() {
return file;
}

public void setFile(File file) {
this.file = file;
}

But when i store it…
id | branding_logo
—+—————
1 | 206533
2 | 206534
3 | 206535
9 | 206543
7 | 206537

How can i identify that is store the image… in database..
I guess it store sequence number…

Please help me…
shashi


Top
 Profile  
 
 Post subject: Re: Bytea and OID datatype in posgres help
PostPosted: Wed Aug 20, 2008 8:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

freedom2k6 wrote:

How can i identify that is store the image… in database..
I guess it store sequence number…



Well, you can just write the code to read the data from the database again. Alternatively you can use some SQL commands to verify the data. See http://www.postgresql.org/docs/8.1/static/lo-funcs.html.

--Hardy


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.