-->
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.  [ 1 post ] 
Author Message
 Post subject: How to map MySQL Binary field in Entity class?
PostPosted: Wed Feb 27, 2008 5:08 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
Hello,

In my application I have to use some tables of a legacy database (MySQL 5). My strategy was to write Entities with JPA annotations for these tables and use a diffent persistent-unit for them. Now, in one of these tables (which I use just in readonly mode) there is a column which is defined in MySQL as
Code:
Binary(2).
In fact it represents a bitfield.

I thought I could map this just with
Code:
Byte[] or byte[]
and it should work. But the Hibernate validation process (on server startup) complains. It expects that the database column would be a "TinyBlob".
I tried some other mappings but with no success.

Then I thought: do it the other way, let Hibernate generate the entity from the database. Now, guess what is the result?
Code:
@Column(name="kind")
    public byte[] getKind()


Ok, besides this mismatch between the Hibernate validator and the Hibernate source generator tool, does anybody has a hot tip what I can do in this situation? Are there any undocumented annotation options which I can use?

Carlo


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.