-->
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.  [ 2 posts ] 
Author Message
 Post subject: Multi level Oracle user defined types - help needed
PostPosted: Mon Nov 14, 2011 5:35 pm 
Newbie

Joined: Wed Apr 28, 2010 11:55 am
Posts: 13
We have these types:

TYPE "T_ADDRESSEE" AS OBJECT
(RECIPIENT T_RECIPIENT,
ADDRESS T_ADDRESS)

TYPE "T_RECIPIENT" AS OBJECT
(NAME VARCHAR2(62),
TITLE VARCHAR2(62),
PHONE VARCHAR2(62),
EMAIL VARCHAR2(100))

TYPE "T_ADDRESS" AS OBJECT
(FIRM VARCHAR2(62),
ADDRESS VARCHAR2(62),
SUITE VARCHAR2(62),
CITY VARCHAR2(62),
STATE VARCHAR2(62),
ZIP VARCHAR2(62))

And in Entity Xxx:
SHIP_TO T_ADDRESSEE

I can do one level using a LDO and an IMPL class that implements org.hibernate.usertype.UserType.

How on earth do you define multi-level types in Hibernate ?

Oh, before you ask, this DB design was done before I got here !!!

Thanks,
Craig.


Top
 Profile  
 
 Post subject: Re: Multi level Oracle user defined types - help needed
PostPosted: Mon Apr 09, 2012 1:13 pm 
Newbie

Joined: Wed Apr 28, 2010 11:55 am
Posts: 13
Still no solution to this problem.

I did a basic JDBC call and T_ADDRESSEE comes back as a Struct containing two attributes, each one a Struct.

Trying to map this in Hibernate: I did a single class representing the outer struct and disassembled it internally. Trying to use this I get:
Code:
Exception in thread "main" org.hibernate.MappingException: Could not determine type for: com.streamlite.common.persistence.userType.FullAddresseeTypeImpl, at table: TBL_ORDERS, for columns: [org.hibernate.mapping.Column(SHIP_TO)]
        at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292)
        at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
        at org.hibernate.mapping.Property.isValid(Property.java:207)
        at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
        at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
        at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
        at com.streamlite.common.persistence.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:199)
        at com.streamlite.common.persistence.util.HibernateUtil.getSession(HibernateUtil.java:209)
        at com.streamlite.common.persistence.util.HibernateUtil.beginTransaction(HibernateUtil.java:219)
        at com.streamlite.test.Test.execute(Test.java:41)
        at com.streamlite.test.Test.main(Test.java:33)


A single level user defined type works fine (struct containing strings). A struct containing structs causes the issues.

Any ideas ?


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