-->
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.  [ 5 posts ] 
Author Message
 Post subject: MiddleGen r5 trouble
PostPosted: Tue Sep 14, 2004 2:17 am 
Newbie

Joined: Thu Sep 09, 2004 2:03 am
Posts: 7
Hibernate version:
2.1.6

In net.sf.hibernate.type.TypeFactory, about Line #94, appears to be this code:
basics.put( byte[].class.getName(), Hibernate.BINARY);

for as you see,
byte[].class.getName() is "]B".

When I use MiddleGen r5 to generate hbm.xml, byte[] type will be generated like this:

Mapping documents:
<property
name="data"
type="byte[]"
column="DATA">
.......

So, when hibernate parsed the hbm.xml, it can't recognize byte[], I have to modify byte[] to ]B manually to make it work.

Is it a bug of r5?

by the way, I am using Oracle 9i and the column "data" is "long raw" type.
In the GUI of r5, there are only 5 choices for it,
byte[]
java.lang.String
java.lang.Object
java.io.InputStream
java.io.Reader

I can only use byte[]/java.io.InputStream, and both of them can't be interpret by hibernate.

What type should I use to handle LONG RAW type for Oracle 9i?

Thanks in advance!

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9i on Linux
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 10:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen will do its best for generating the types but there are cases where it will not pick the appropriate value. The hibernate plugin has its own type mapper with an approriate interface for setting it. This allows you to create your own default mapper for the types you need. Check it out.


Top
 Profile  
 
 Post subject: ?
PostPosted: Tue Sep 14, 2004 10:47 pm 
Newbie

Joined: Thu Sep 09, 2004 2:03 am
Posts: 7
Would you please do me a favour by explaining it more ?I think I don't pick up what you mean. thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 7:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The drop down type selection by default will pick Java types. This is the default for Middlegen since its design goal was to generate Java code. The hibernate plugin generates XML and in some cases the type needs to something else (in your case either, binary or java.sql.blob). This not not well supported in Middlegen but there are option:
1) is to use the JavaType Mapper interface (I did do some enhancements in this area) to provide a better default type mapping.
2) Pick a unique type and then post process the XML output and substitute it with an appropriate tool, eg, sed or <replaceregexp> Ant tag, ie,

Code:
   <replaceregexp
    match='java.lang.Object'   
    replace='binary'
    byline="true">
    <fileset dir="${hbm.dir}" includes="MapRequest.hbm.xml,MapRun.hbm.xml" />
   </replaceregexp>


Top
 Profile  
 
 Post subject: Thanks a lot!
PostPosted: Mon Sep 20, 2004 10:17 pm 
Newbie

Joined: Thu Sep 09, 2004 2:03 am
Posts: 7
Thanks a lot!


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