-->
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: middlegen + hbm2java great, but need help for byte[]!
PostPosted: Fri Jul 30, 2004 4:12 pm 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
Hey all,
Hibernate newbie, so forgive me if this is something I just may yet not understand. I'm using the middlegen-Hibernate-R5 plugin to generate hbm.xml files from an existing database. I've written a JavaTypeMapper to cast Binary types to byte[]. This, of course, does not work during deployment as it does not understand the byte[] 'type' from the XML.

Somewhere I came across the net.sf.hibernate.type.BinaryType, gave that a try and setting the hbm.xml 'type' field works, but using hbm2java it does not convert it to a byte[] as I had hoped.

Further I also found this article: http://www.hibernate.org/73.html which seems kinda what I thought net.sf.hibernate.type.BinaryType would do, but still involves modifying generated code.

Rather than trying to modify generated code (which really is a no-no in my opinion), has anyone solved this problem or have better/easier pointers to help get past this problem?

Thanky!
-D


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 1:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
User types do not provide the information necessary for generation tools to perform the appropriate conversion(s) so you need to look to the tools. In the case of hbm2java it has a meta tag 'property-type' which should be able to help. Middlegen does not generate this particular meta tag at this point. Create a enhancement request in JIRA so I don't forget it.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 1:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if the UserType can be resolved by hbm2java then it will call it's getReturnedClass() and use that as it's type - should work IMO.

(but if it's tricky then the property-type can be used as a workaround ;)

_________________
Max
Don't forget to rate


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.