-->
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: How to alias annotated class
PostPosted: Thu Mar 11, 2010 6:45 pm 
Newbie

Joined: Mon Jun 05, 2006 11:44 am
Posts: 11
I have a Java POJO I've mapped to my table using Hibernate's annotations.

Right now my mapped POJO class has a rather awkward suffix. I would like to somehow alias my mapped class to a name that makes writing the HQL queries more natural

For example, I'd like:
Code:
FROM User u WHERE u.name = ......


...rather than:
Code:
FROM UserAwkwardSuffix u WHERE u.name = ......


...without having to refactor POJO class names.

It's a bit of a nitpick, but I'm curious how/if this is possible?


Top
 Profile  
 
 Post subject: Re: How to alias annotated class
PostPosted: Mon Mar 15, 2010 5:28 pm 
Newbie

Joined: Mon Jun 05, 2006 11:44 am
Posts: 11
I figured it out. Use JPA's @Entity(name="YourDesiredEntityName") annotation.

This allows you to specify how you refer to annotated classes in your HQL queries.


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.