-->
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.  [ 3 posts ] 
Author Message
 Post subject: Custom Annotation
PostPosted: Sun Sep 11, 2011 5:20 pm 
Newbie

Joined: Sun Sep 11, 2011 4:45 pm
Posts: 2
Hi You all,

I would know if there's a way to define a custom Annotation i.e. "@UserDataEntity" (with RetentionPolicy.RUNTIME) inside of an Entity class, like code below:

@UserDataEntity
@Entity
@Table(name = "XXXXX", catalog = "YYYYY")
.....

So, if there's an answer to my question, how to access this class attribute at runtime using reflection?

Scanning Entity metadata, through org.hibernate.Configuration (sessionFactoryBean.getConfiguration()) , I only get

org.hibernate.mapping.PersistentClass.

I'm using Hibernate 3.2.4.sp1 version

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Custom Annotation
PostPosted: Mon Sep 12, 2011 6:37 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Don't see what this has to do with Hibernate... You can add any annotations that you like to your classes. Hibernate doesn't care about it and you will of course not find any information about those annotations in the Hibernate metadata. Use the regular java reflection api instead. Eg. Class.getAnnotation(), etc.


Top
 Profile  
 
 Post subject: Re: Custom Annotation
PostPosted: Wed Sep 14, 2011 5:31 am 
Newbie

Joined: Sun Sep 11, 2011 4:45 pm
Posts: 2
Thank You very much,

I followed your suggest....

M.B.


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