-->
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 userTypes in hsql. Is it possible to map multiple?
PostPosted: Mon Mar 21, 2011 3:55 pm 
Newbie

Joined: Mon Mar 21, 2011 3:40 pm
Posts: 10
Hello,
I have successfully created User Types with Postgres, and can read and write successfully.

@org.hibernate.annotations.Type(type = "com.xxx.datamodel.ext.FooType" )
@Column(name = "foo", nullable = false)
private int[] foo

@org.hibernate.annotations.Type(type = "com.xxx.datamodel.ext.BarType" )
@Column(name = "bar", nullable = false)
private double[] bar

However, when I try to use the HSQLDialect I get:
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: 2003
at org.hibernate.dialect.TypeNames.get(TypeNames.java:79)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:104)
at org.hibernate.dialect.Dialect.getTypeName(Dialect.java:314)
at org.hibernate.mapping.Column.getSqlType(Column.java:205)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:420)
at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:895)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:105)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:353)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 55 more

2003 is java.sql.Types.Array
Looks like it fails while trying to create the schema, and I'm not sure how to tell HSQL to create the proper type.

I found another somewhat related post that suggested I extend HSQLDialect and register a column type:
...
registerColumnType(Types.ARRAY, FooType.class.getCanonicalName() );
registerColumnType(Types.ARRAY, BarType.class.getCanonicalName() );
...

Problem with this approach is that there is only one mapping allowed per SQL Type and it doesn't resolve correctly between int[] and double[]... Not sure if this is even the correct approach.

Help?

-JD


Top
 Profile  
 
 Post subject: Re: Mapping userTypes in hsql. Is it possible to map multiple?
PostPosted: Tue Mar 22, 2011 10:53 am 
Newbie

Joined: Mon Mar 21, 2011 3:40 pm
Posts: 10
No one wants to touch this?
Has anyone ever seen this before?


Top
 Profile  
 
 Post subject: Re: Mapping userTypes in hsql. Is it possible to map multiple?
PostPosted: Wed Jun 22, 2011 12:28 pm 
Newbie

Joined: Tue Jun 21, 2011 12:33 pm
Posts: 2
Bubba,

How did you solve this? I've run into similar behavior using PostgreSQL: No Dialect mapping for JDBC type: 2003


Top
 Profile  
 
 Post subject: Re: Mapping userTypes in hsql. Is it possible to map multiple?
PostPosted: Thu Jun 23, 2011 2:01 am 
Newbie

Joined: Sat May 19, 2007 5:56 am
Posts: 5
u r using primitive data types; can u try using Integer and Long?

was this class autogenerated? if not then can u try auto generating; hibernate has eclipse plugins for this.

I generally see autogenerated stuff haveing List<> or Set<> its strang to see array;

hope this helps


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.