-->
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: Hibernate Search Metamodel
PostPosted: Fri Mar 01, 2013 5:47 am 
Newbie

Joined: Thu Oct 21, 2010 5:48 am
Posts: 9
In my application I have unidirectional associations between entities where the source is marked as @IndexedEmbedded.
To update the index of the source entity, if the target of the assosiation is changed, I use JPA Callbacks on target entities to track the changes.
In the JPA Callbacks I want to find generically all JPA entitiy candidate classes whose index needs to be udated manually.

I believe, the simplest way to find such entities would be to analyse the Hibernate Search Metamodel and JPA Metamodel by traversing the entity metamodel graph.

I could implement code which analyses the Search annotations on entities. But if the Search Mapping is provided programatically by custom SearchMapping @Factory method,
I have probably no chance to reconstruct the mapping correctly at runtime.

Another problem is to find bi-directional associations in the JPA metamodel. But this is not releated to Search.

I didnt't find anything about Hibernate Search Metamodel in reference documentation.

Is there any safe (maybe non-API) way to access the Search Metamodel at runtime?

_________________
М.стер Ха..ерн..т


Top
 Profile  
 
 Post subject: Re: Hibernate Search Metamodel
PostPosted: Fri Mar 01, 2013 7:59 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hello,
no sorry the metamodel is not accessible and also the way it's stored today might not make it too easy for you to hack around it.
If you want to take a look, it's all in a large and overgrown class named DocumentBuilder (with two extensions).

Coincidentally we just decided last week that it's time to refactor this class and expose the metadata, as there are several other projects which could better integrate with it. If you want to take this task, we'll be glad to advise you and do some rounds of code review, and apply your patches upstream.

This looks like a good starting point:
https://hibernate.onjira.com/browse/HSEARCH-918

As a simpler solution, wouldn't you prefer to change your domain model to use bi-directional relations?

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


Top
 Profile  
 
 Post subject: Re: Hibernate Search Metamodel
PostPosted: Fri Mar 01, 2013 8:30 am 
Newbie

Joined: Thu Oct 21, 2010 5:48 am
Posts: 9
Hello Sanne,
sanne.grinovero wrote:
Coincidentally we just decided last week that it's time to refactor this class and expose the metadata, as there are several other projects which could better integrate with it. If you want to take this task, we'll be glad to advise you and do some rounds of code review, and apply your patches upstream.

Thank you for the advice. I will at least try it in the next time.

sanne.grinovero wrote:
As a simpler solution, wouldn't you prefer to change your domain model to use bi-directional relations?

Unfortunately it's not possible by component based design of our software.
If two entities belong to different components, only one of them can reference the other one.

_________________
М.стер Ха..ерн..т


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.