-->
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: best mapping strategy for images
PostPosted: Tue Sep 07, 2004 8:09 am 
Beginner
Beginner

Joined: Wed Mar 10, 2004 9:51 am
Posts: 42
Location: France
Hibernate version:2.16 mysql and hibernate:

Hi there,

I'm just in a little bit of confusion recently regarding the best way to
store image files to the database.

I am reading that blob and clob are not necessary portable to all
databases.

I'm really concentrating on mysql and postgres for the first version
of my project.

What is the best strategy to use ? I am currently using binary as
per the included class.

I have noticed that my test cases run somewhat slowly.

Is this because binary is slower than blob which I gather is lazy loaded ?

Also if it is lazy loaded will it automatically be fetched before I transfer it
to the web layer or a desktop client ?

Thank you

Bryan

snip=
/*
* Created on 24 mai 2004
* Bryan Hunt 2004
* Code licenced under the LGPL license
*/

package ie.jestate.bo.bases;

import ie.jestate.bo.property.Property;

import java.io.Serializable;

/**
* @hibernate.class table = "jestate_property_image"
*
*/

public class PropertyImage implements Serializable {

protected Property associatedProperty;

protected byte[] data;

protected Integer id = new Integer(-1);

protected Integer position = new Integer(0);

protected String title;

public PropertyImage() {
super();
}

public PropertyImage(byte[] data) {
super();
this.data = data;
}

public PropertyImage(byte[] data, String title, Integer position) {

}

/**
* @return Returns the associatedProperty.
*/
public Property getAssociatedProperty() {
return associatedProperty;
}

/**
* @hibernate.property length = "1000000" not-null = "true" unique = "false" type="blob"
*
*
*/
public byte[] getData() {
return this.data;
}

/**
* @hibernate.id generator-class="native" unsaved-value = "-1"
*
*
*/
public Integer getId() {
return id;
}

/**
* @hibernate.property
*/
public Integer getPosition() {
return position;
}

/**
* @hibernate.property column = "title"
*/
public String getTitle() {
return title;
}

/**
* @param associatedProperty
* The associatedProperty to set.
*/
public void setAssociatedProperty(Property associatedProperty) {
this.associatedProperty = associatedProperty;
}

/**
*
*
*/
public void setData(byte[] data) {
this.data = data;
}

/**
* @param long1
*
*
*/
public void setId(Integer i) {
id = i;
}

/**
* This method sets the images display priority the higher the number the
* closer to the top of the page it will be displayed.
*
* @param i
* The position
*
*
*/
public void setPosition(Integer i) {
position = i;
}

/**
* @param title
* The title to set.
*/
public void setTitle(String title) {
this.title = title;
}

}
=snip

_________________
Pesimist: The glass is half empty
Optimist: The glass is half full
Engineer:The glass should be half that size


Top
 Profile  
 
 Post subject: Re: best mapping strategy for images
PostPosted: Tue Sep 07, 2004 8:11 am 
Beginner
Beginner

Joined: Wed Mar 10, 2004 9:51 am
Posts: 42
Location: France
[quote="bryanhunt"]sorry should be mysql and postgres rather than
mysql and hibernate

_________________
Pesimist: The glass is half empty
Optimist: The glass is half full
Engineer:The glass should be half that size


Top
 Profile  
 
 Post subject: please ignore my original question
PostPosted: Tue Sep 07, 2004 8:28 am 
Beginner
Beginner

Joined: Wed Mar 10, 2004 9:51 am
Posts: 42
Location: France
My appologies, I have found these two topics which answer my
question just fine.

http://forum.hibernate.org/viewtopic.php?t=928207

http://forum.hibernate.org/viewtopic.php?t=927911

_________________
Pesimist: The glass is half empty
Optimist: The glass is half full
Engineer:The glass should be half that size


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.