-->
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: Does @Type annotation work
PostPosted: Fri Feb 06, 2009 4:41 pm 
Newbie

Joined: Fri Dec 05, 2008 6:58 pm
Posts: 7
Hibernate version: 3.2.6

Name and version of the database you are using: Derby


I am trying to use @Type annotation to use a custom UserType that maps Blob to byte[]. (See http://www.hibernate.org/73.html)

Here is the code that tries to use this annotation -

@TypeDefs (
{
@TypeDef(
name="MyBlob", typeClass=mypackage.MyBlobType.class
)
}
)

@Entity
@Table(name="MY_TABLE")
public class MyClass {

private byte[] _objData;

@Type(type="MyBlob")
public void setObjData(byte[] objData) {
this._objData = objData;
}

public byte[] getObjData() {
return _objData;
}
}

PROBLEM
------------
When I generate the ddl, the column corresponding to byte[] still gets mapped to varchar for bit data which is the default mapping for byte[] and not to Blob as per my custom user type.

Does anyone know if the @Type annotation works ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2009 8:23 am 
Newbie

Joined: Thu Mar 03, 2005 3:25 pm
Posts: 5
I'm using the @Type annotation right now. (With a couple caveats: on the current project, I'm not generating the DB, and I am not using the @Typedef annotation, but referring to the custom type class directly in the @Type annotation.)

I would try to reference the class directly in the @Type annotation and then look to the implementation of the TypeDef class for the problem.

David


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2009 11:42 am 
Newbie

Joined: Fri Dec 05, 2008 6:58 pm
Posts: 7
Thanks. I tried this without the typedef and referencing the custom type directly in the annotation.

I faced the same problems. Maybe I need to hand-code my DDL and things would work as normal after that ?


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.