-->
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: Avoiding prefix when accessing a field of associated entity
PostPosted: Sat Feb 14, 2009 9:30 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2009 12:29 pm
Posts: 49
My Hibernate search version is 3.1
I'm using projection to retrieve fields from an indexed entity and its associated entity marked with IndexedEmbedded annotation. I'm using a bean as the data structure along with AliasToBeanResultTransformer as the result transformer. I need to have setters in the bean for all the fields to be retrieved. However, this is causing a problem in the case of the fields of the associated entity because of the dot in the field name.

For example, the property in my main entity which holds the associated entity is "inventory". One of the fields to be retrieved is thus "inventory.vin"
But I cannot have a setter method corresponding to this in the bean because it is not allowed to have a dot in the setter name. How can I change the name so that it can be accessed as just "vin" without the prefix?

I tried using the name attribute of the Field annotation to change the field name, but it still requires the prefix.

Please advise.

Thanks,
Seema


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 15, 2009 3:36 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
you can use

Code:
IndexedEmbedded(prefix="inventory")

to define the complete prefix: Hibernate Search won't add the dot for you, so you'll end up with "inventoryvin".
Usually when defining a custom prefix the problem is to not forget the dot ;-)

_________________
Sanne
http://in.relation.to/


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.