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.  [ 4 posts ] 
Author Message
 Post subject: Mapping of java.net.URL
PostPosted: Sun May 08, 2005 6:13 am 
Newbie

Joined: Sun May 08, 2005 4:19 am
Posts: 2
Greetings

I am using a "third party library" (Informa) a that is consequently using hibernate. There is a trouble saving attribute which has a java.net.URL type.
When Hibernate saves it to DB, it just leaves a blank string '' there (even if there are valid data in the object) and when loading this garbage it,logically, fails to deserialize the URL. My question is...what are we doing bad? What is the correct mapping of java.net.URL type in MySQL environments?

thanks for your time

Jakub Hozak

the mapping details follows:

Mapping documents:
Code:
<property name="site" type="java.net.URL" update="true" insert="true" column="SITE" not-null="false" unique="false" />


Name and version of the database you are using:MySQL 4.1.11


column creating code:
Code:
SITE VARCHAR(255) BINARY


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 8:52 am 
Newbie

Joined: Wed Aug 11, 2004 3:30 am
Posts: 5
Location: Oslo, norway
Perhaps changing the type to serializable would help?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 12:25 pm 
Newbie

Joined: Sun May 08, 2005 4:19 am
Posts: 2
simen wrote:
Perhaps changing the type to serializable would help?


unfortunately it didn't help, maybe the 'varchar binary' is wrong?
with what should I replace it?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 09, 2005 2:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
No idea what "varchar binary" is. These should map to the JDBC VARBINARY type, although I have no idea of the corrolary DB type for that on MySQL.

Another option is to map this using a user-type. Then you could store it in the database as a simple VARCHAR using URL.toExternalForm().


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