-->
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: Hibernate annotations without hibernate-core ?
PostPosted: Wed Aug 17, 2011 3:03 am 
Newbie

Joined: Tue Aug 16, 2011 10:28 am
Posts: 1
Hello,

We are trying to move from our "in house" orm to JPA. For some attributes, we need to define hibernate UserType.
The problem is that we would like to keep hibernate-core as an optional dependency in our legacy framework and at the same time being able to use hibernate UserType (i.e. using @Type, @TypeDefs).

For instance, the following class "AuditSegment" is an embeddable entity that uses the UserType "MyUserType". Unfortunately, this class is annotated by the annotations "TypeDefs", "TypeDef" and "Type" contained in hibernate-core and so it is no more an optional feature in the classpath.

Code:
@TypeDefs({
        @TypeDef(name = " MyUserType ", typeClass = MyUserType.class)
})
@Embeddable
public class AuditSegment {

    @Type(type = " MyUserType")
    ComplexObject  aComplexObject;

}


Is there a way to avoid that situation? For instance, we can declare user types at the package level in package-info.java in an optional JAR, but can we do something similar with the "@Type" annotation?

We took a look at to the only alternative we have found: XML mapping files. With XML files, the type definition looks like:

Code:
<typedef name=" MyUserType "
      class="com.xyz.jpa.support.mapper.MyUserType "></typedef>


The type annotation can be declared in XML like that:
Code:
<property name=" aComplexObject" type=" MyUserType "/>


But, it seems that if we start using hbm files in some classes, we have to use hbm mapping files for the whole class hierarchy and we would like to promote usage of annotations.

Any suggestions/solutions are welcome ?

Thanks :)

S.


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.