As promised I am following up with the current state of development in this blog entry.
Firstly, let's take a look at what standard Hibernate Search annotated entities would look like:
First our Game Entity:
And the Vendor Entity:
To get this to work properly in the current state of my Generic JPA version an additional @InIndex is needed at the class-level:
This is a requirement when working with the general JPA specification as some implementors create subclasses
for each Entity and Hibernate-Search needs to know which class in the hierarchy was the original one that
was supposed to be in the Index.
At the moment we configure our Hibernate Search instance by subclassing JPASearchFactory. While
this might be a bit unconvenient for production use it gets the job done easily during development.
Later on this will be possible to be configured via a properties/xml file.
Note that this is an example for a SearchFactory in a Java EE application:
The only thing that is needed to get this whole thing to work are the Updates classes. As of now the user
has to create these on his own. This will hopefully not be a requirement in the future, anymore.
Note that the user not only has to create a table for each Entity, but also one for each mapping table as well.
For an existing database the user will have to index a manually for now (However: All data that is persisted AFTER
the setup was done will be updated automatically):
Now that we have set all this up correctly, we can search just like with normal Hibernate Search ORM:
This is it for now. Stay tuned for further updates!
Happy Coding,
Martin
Enjoyed your approach to explaining how it works, hope to see more blog posts from you. thank you!
AntwortenLöschenHibernate Online Training | Java Online Training
Hibernate Training in Chennai Java Training in Chennai