-->
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.  [ 3 posts ] 
Author Message
 Post subject: Uploading image files to oracle database
PostPosted: Wed Jul 30, 2008 4:02 am 
Newbie

Joined: Thu Jan 24, 2008 12:24 pm
Posts: 5
Hi,
I am pretty new with Hibernate. Can any one give an example of uploading image files to oracle database.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 30, 2008 7:44 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Well, you'll need to map fields to a LOB. But uploading the image is simply a web based problem. GWT and Struts have built in libraries that show you how to do that over the web. But it's a Servlet/JSP issue more than a Hibernate issue.

Code:
@Entity
@Table(name = "BlobClobBoBob", schema = "examscam")
public class BlobClobber {
  Long id;
  String beans;
  char[] ming;
  Character[] witness;
  java.sql.Clob sqlClob;

  java.sql.Blob sqlBlob;
  byte[] me;
 
  @Id
  @GeneratedValue
  @Column(name = "id")
  public Long getId() {return id;}
  @Lob
  public String getBeans() {return beans;}
  @Lob
  public byte[] getMe() {return me;}
  @Lob
  public char[] getMing() {return ming;}
  @Lob
  public java.sql.Blob getSqlBlob() {return sqlBlob;}
  @Lob
  public java.sql.Clob getSqlClob() {return sqlClob;}
  @Lob
  public Character[] getWitness() {return witness;}

  public static void main(String args[]) {
   AnnotationConfiguration config =
                          new   AnnotationConfiguration();
   config.addAnnotatedClass(BlobClobber.class).configure();
   new SchemaExport(config).create(true, true);
  }
}

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 1:44 pm 
Newbie

Joined: Thu Jan 24, 2008 12:24 pm
Posts: 5
Well, Thank you very much for your reply

i dont know hibernate annotations, so i am not able to understand it.

i takes some time to understand annotations and creating hbm files out of it.

if you can send me the hbm file it would be very helpfull.


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