http://in.relation.to/In Relation To Blog2015-07-31T21:32:40+00:00http://in.relation.to/2015/07/30/hibernate-orm-500-cr3-release/Third Candidate Release for ORM 5.02015-07-30T00:00:00Z2015-07-30T00:00:00ZSteve Ebersole
Yesterday I released the third candidate release for Hibernate ORM 5.0 (5.0.0.CR3). We felt another CR was warranted
because we had some minor integration (SPI) work that we needed to make in to Final, but too much development had happened since
the second CR to be considered risk free to just include everything into Final. At any rate CR3 got lots of great TLC :) The
complete set of changes can be seen in the Jira changelog. The
main changes include:
Minor changes to the caching SPI
Essentially passing Session along to the various region access strategy methods to allow integrating with...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Yesterday I released the third candidate release for Hibernate ORM 5.0 (5.0.0.CR3). We felt another CR was warranted
because we had some minor integration (SPI) work that we needed to make in to Final, but too much development had happened since
the second CR to be considered risk free to just include everything into Final. At any rate CR3 got lots of great TLC :) The
complete set of changes can be seen in the <a href="https://hibernate.atlassian.net/projects/HHH/versions/20350">Jira changelog</a>. The
main changes include:</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="minor-changes-to-the-caching-spi">
<a class="anchor" href="#minor-changes-to-the-caching-spi"></a>Minor changes to the caching SPI</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Essentially passing Session along to the various region access strategy methods to allow integrating with non-JDBC transactions.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="work-on-schema-tooling">
<a class="anchor" href="#work-on-schema-tooling"></a>Work on schema tooling</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Improved namespace (catalog/schema) support overall in schema tools. Improved handling of views and synonyms for migrating and validating.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="work-on-bytecode-enhancement">
<a class="anchor" href="#work-on-bytecode-enhancement"></a>Work on bytecode enhancement</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Lots of fixes based on feedback.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="consistency-in-transaction-api">
<a class="anchor" href="#consistency-in-transaction-api"></a>Consistency in Transaction API</h2>
<div class="sectionbody">
<div class="paragraph">
<p>A few changes were made to the JDCB-based TransactionCoordinator to work more like in JTA environments. Specifically:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>implemented support for marking the Transaction for rollback-only.</p>
</li>
<li>
<p>transaction is now rolled back automatically on a failed commit.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="work-on-the-documentation">
<a class="anchor" href="#work-on-the-documentation"></a>Work on the documentation</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Besides updating the content, the content has been split into 3 separate guides:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>User Guide</p>
</li>
<li>
<p>Domain Model Mapping Guide</p>
</li>
<li>
<p>Integrations Guide</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-to-get-it">
<a class="anchor" href="#how-to-get-it"></a>How to get it</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Additionally many other improvements and bugfixes are included. See <a href="https://hibernate.atlassian.net/projects/HHH/versions/20150" class="bare">https://hibernate.atlassian.net/projects/HHH/versions/20150</a> for the complete list of changes.</p>
</div>
<div class="paragraph">
<p>The release tag is available at <a href="https://github.com/hibernate/hibernate-orm/releases/edit/5.0.0.CR3" class="bare">https://github.com/hibernate/hibernate-orm/releases/edit/5.0.0.CR3</a></p>
</div>
<div class="paragraph">
<p>As always, see <a href="http://hibernate.org/orm/downloads/" class="bare">http://hibernate.org/orm/downloads/</a> for information on obtaining the releases.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/30/hibernate-validator-521-final/Hibernate Validator 5.2.1.Final<sup>*</sup>2015-07-30T00:00:00Z2015-07-30T00:00:00ZHardy Ferentschik
I know you have been waiting in anticipation, but now it is available -
Hibernate Validator 5.2.1.Final :-). Given that it is a drop-in replacement for
all 5.x releases, there is no reason to delay an upgrade. Just go and
get it.
For the more cautious, here again the highlights of the 5.2 release with
pointers to more information.
The highlights
Java 8 Support, most notably the ability to validate Optional and the new
date/time types. Types, which do not represent an instant on
the time-line, however, are not supported out of the box. This includes,
for example, LocalDate and its sub-types. Semantically it does not make
sense to talk about...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>I know you have been waiting in anticipation, but now it is available -
Hibernate Validator 5.2.1.Final :-). Given that it is a drop-in replacement for
all 5.x releases, there is no reason to delay an upgrade. Just go and
<a href="#get-it">get it</a>.</p>
</div>
<div class="paragraph">
<p>For the more cautious, here again the highlights of the 5.2 release with
pointers to more information.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="highlights">
<a class="anchor" href="#highlights"></a>The highlights</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p>Java 8 Support, most notably the ability to validate <code>Optional</code> and the new
date/time types. Types, which do not represent an instant on
the time-line, however, are not supported out of the box. This includes,
for example, <code>LocalDate</code> and its sub-types. Semantically it does not make
sense to talk about future and past, if your data type cannot be
unambiguously tied to an instant in time. This is still a bit of a open
discussion (see <a href="https://hibernate.atlassian.net/browse/HV-981">HV-981</a>) though.
<a href="#contact">Contact us</a> if you have an opinion.<br></p>
<div class="paragraph">
<p>Support for Java 8 also includes the use of type annotation constraints like:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">List</span>&lt;<span style="color:#007">@AcmeEmail</span> <span style="color:#0a8;font-weight:bold">String</span>&gt; emails;</code></pre>
</div>
</div>
<div class="paragraph">
<p>In this case each element of the <code>emails</code> list (or more generally of any <code>Iterable</code>)
will be validated using the <code>@AcmeEmail</code>. Note the use of a custom constraint and not
the Hibernate Validator provided <code>@Email</code>. The reason is that all provided constraints
are missing <code>java.lang.annotation.ElementType.TYPE_USE</code> in their definition for now.
Adding it would break backwards compatibility to Java 6.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Java 8 is not a requirement for Hibernate Validator 5.2. It
is still backward compatible with Java 6. Java 8 specific features are only
enabled in case a Java 8 runtime is detected.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p><a href="http://in.relation.to/2014/10/23/hibernate-validator-520-alpha-1-with-java-8-support-and-a-51-maintenance-release/#H-Java8Support">read more …​</a></p>
</div>
</li>
<li>
<p>Ability to provide custom constraints discoverable
via the Java <a href="http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html/">ServiceLoader</a> mechanism.
Under the hood this uses the new <code>ConstraintMappingContributor</code> SPI.
<a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort/#H-ProgrammaticConstraintMappingViaConstraintMappingContributor">read more…​</a></p>
</li>
<li>
<p>Ability to use Hibernate Validator without dependency to the Expression
Language libraries by using the new <code>ParameterMessageInterpolator</code>.
<a href="http://in.relation.to/2014/10/23/hibernate-validator-520-alpha-1-with-java-8-support-and-a-51-maintenance-release#H-TtParameterMessageInterpolatortt">read more…​</a></p>
</li>
<li>
<p>Ability to provide an external <code>ClassLoader</code>. Potentially handy for
modularized environments. <a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort/#H-AbilityToProvideExternalClassLoader">read more…​</a></p>
</li>
<li>
<p>Apache Karaf feature file.
<a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort/#H-HibernateValidatorFeaturesxmlForApacheKaraf">read more…​</a></p>
</li>
<li>
<p>Extension of the
<a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.1/api/javax/validation/Path.html">Path API</a>
for nodes of type <code>ElementKind.PROPERTY</code>, which allows to obtain the value
of the represented property.
<a href="http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html_single/#section-extensions-path-api">read more…​</a></p>
</li>
<li>
<p>TimeProvider contract. <a href="http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html_single/#section-time-provider">read more…​</a></p>
</li>
<li>
<p>Tons of bug fixes</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="get-it">
<a class="anchor" href="#get-it"></a>Where to get it</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Maven artifacts can be found in the <a href="http://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/hibernate-validator/5.2.1.Final/">JBoss Maven</a> repository, as well as in <a href="http://search.maven.org/#artifactdetails%7Corg.hibernate%7Chibernate-validator%7C5.2.1.Final%7Cjar">Maven Central</a>. The GAV is <em>org.hibernate:hibernate-validator:5.2.1.Final</em>.
Distribution bundles will be uploaded to
<a href="https://sourceforge.net/projects/hibernate/files/hibernate-validator/5.2.1.Final">SourceForge</a> once it has recovered from its <a href="http://sourceforge.net/blog/sourceforge-infrastructure-and-service-restoration-update-for-728">storage fault</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="whats-next">
<a class="anchor" href="#whats-next"></a>What’s next</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Further development will be driven by the upcoming Bean Validation update -
Bean Validation 1.2. Most likely this will align with a Hibernate Validator 6
requiring Java 8. This will be necessary to make use of all the new features
Java 8 offers, amongst others the use of
<code><a href="https://docs.oracle.com/javase/tutorial/java/annotations/repeating.html">@Repeatable</a></code>.
This is in alignment with other technologies which are part of the Java EE 8
standard.</p>
</div>
<div class="paragraph">
<p>Watch for changes to the Hibernate Validator
<a href="http://hibernate.org/validator/roadmap/">roadmap</a>,
as well as announcements on this and the
<a href="http://beanvalidation.org">Bean Validation</a> blog.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="contact">
<a class="anchor" href="#contact"></a>Let us know what you think</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Feedback and questions are welcome via the Hibernate Validator
<a href="https://forum.hibernate.org/viewforum.php?f=9">forum</a> or on
stackoverflow using the hibernate-validator
<a href="http://stackoverflow.com/questions/tagged/hibernate-validator">tag</a>.
If that is not enough, check out the other ways you can get in
<a href="http://hibernate.org/community">contact</a> with us.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="thank-you">
<a class="anchor" href="#thank-you"></a>Thank you</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Last but not least, a big thank you to all of you who were lending a helping hand
along the way, be it via a bug report or more hands on via a pull request. Special
thanks to <a href="https://github.com/khalidq">Khalid</a> who kicked of the work on the 5.2
release series with his Google Summer of Code work.
Thank you also for the smaller contributions provided by
<a href="https://github.com/denistiago">Denis Tiago</a>,
<a href="https://github.com/NicolaF">Nicolas Francois</a>,
<a href="https://github.com/sosna">Xavier Sosnovsky</a>,
<a href="https://github.com/dernasherbrezon">dernasherbrezon</a>,
<a href="https://github.com/stawny">stawny</a> and
<a href="https://github.com/tonnyyi">tonnyyi</a>.
Finally a thank you to all other Hibernate team members who were involved.</p>
</div>
<div class="paragraph">
<p>Enjoy!</p>
</div>
<hr>
<div class="paragraph">
<p>* In case you are wondering what happened with 5.2.0.Final, it became obsolete while waiting for SourceForge to recover. In the meantime an IBM JVM specific issue (<a href="https://hibernate.atlassian.net/browse/HV-1007">HV-1007</a>) was reported and fixed.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/24/hibernate-search-complex-type-query/Handling queries on complex types in Hibernate Search2015-07-24T00:00:00Z2015-07-24T00:00:00ZEmmanuel Bernard
Writing queries using complex types can be a bit surprising in Hibernate Search.
For these multi-fields types, the key is to target each individual field in the query.
Let’s discuss how this works.
What’s a complex type?
Hibernate Search lets you write custom types that take a Java property and create Lucene fields in a document.
As long as there is a one property for one field relationship, you are good.
It becomes more subtle if your custom bridge stores the property in several Lucene fields.
Say an Amount type which has the numeric part and the currency part.
Let’s take a real example from a user using...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Writing queries using complex types can be a bit surprising in Hibernate Search.
For these <strong>multi-fields types</strong>, the key is to <strong>target each individual field in the query</strong>.
Let’s discuss how this works.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-s-a-complex-type">
<a class="anchor" href="#what-s-a-complex-type"></a>What’s a complex type?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Hibernate Search lets you write custom types that take a Java property and create Lucene fields in a document.
As long as there is a one property for one field relationship, you are good.
It becomes more subtle if your custom bridge stores the property in several Lucene fields.
Say an <code>Amount</code> type which has the numeric part and the currency part.</p>
</div>
<div class="paragraph">
<p>Let’s take a real example from a user using <a href="http://infinispan.org">Infinispan</a>'s search engine -
proudly served by <a href="http://hibernate.org/search/">Hibernate Search</a>.</p>
</div>
<div class="listingblock">
<div class="title">The <code>FieldBridge</code>
</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">JodaTimeSplitBridge</span> <span style="color:#088;font-weight:bold">implements</span> TwoWayFieldBridge {
<span style="color:#777">/**
* Set year, month and day in separate fields
*/</span>
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">void</span> set(<span style="color:#0a8;font-weight:bold">String</span> name, <span style="color:#0a8;font-weight:bold">Object</span> value, <span style="color:#0a8;font-weight:bold">Document</span> document, LuceneOptions luceneoptions) {
DateTime datetime = (DateTime) value;
luceneoptions.addFieldToDocument(
name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.year</span><span style="color:#710">"</span></span>, <span style="color:#0a8;font-weight:bold">String</span>.valueOf(datetime.getYear()), document
);
luceneoptions.addFieldToDocument(
name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.month</span><span style="color:#710">"</span></span>, <span style="color:#0a8;font-weight:bold">String</span>.format(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">%02d</span><span style="color:#710">"</span></span>, datetime.getMonthOfYear()), document
);
luceneoptions.addFieldToDocument(
name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.day</span><span style="color:#710">"</span></span>, <span style="color:#0a8;font-weight:bold">String</span>.format(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">%02d</span><span style="color:#710">"</span></span>, datetime.getDayOfMonth()), document
);
}
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#0a8;font-weight:bold">Object</span> get(<span style="color:#0a8;font-weight:bold">String</span> name, <span style="color:#0a8;font-weight:bold">Document</span> document) {
IndexableField fieldyear = document.getField(name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.year</span><span style="color:#710">"</span></span>);
IndexableField fieldmonth = document.getField(name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.month</span><span style="color:#710">"</span></span>);
IndexableField fieldday = document.getField(name+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">.day</span><span style="color:#710">"</span></span>);
<span style="color:#0a8;font-weight:bold">String</span> strdate = fieldday.stringValue()+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">/</span><span style="color:#710">"</span></span>+fieldmonth.stringValue()+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">/</span><span style="color:#710">"</span></span>+fieldyear.stringValue();
DateTime value = DateTime.parse(strdate, DateTimeFormat.forPattern(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">dd/MM/yyyy</span><span style="color:#710">"</span></span>));
<span style="color:#080;font-weight:bold">return</span> <span style="color:#0a8;font-weight:bold">String</span>.valueOf(value);
}
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#0a8;font-weight:bold">String</span> objectToString(<span style="color:#0a8;font-weight:bold">Object</span> date) {
DateTime datetime = (DateTime) date;
<span style="color:#339;font-weight:bold">int</span> year = datetime.getYear();
<span style="color:#339;font-weight:bold">int</span> month = datetime.getMonthOfYear();
<span style="color:#339;font-weight:bold">int</span> day = datetime.getDayOfMonth();
<span style="color:#0a8;font-weight:bold">String</span> value = <span style="color:#0a8;font-weight:bold">String</span>.format(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">%02d</span><span style="color:#710">"</span></span>,day)+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">/</span><span style="color:#710">"</span></span>+<span style="color:#0a8;font-weight:bold">String</span>.format(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">%02d</span><span style="color:#710">"</span></span>,month)+<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">/</span><span style="color:#710">"</span></span>+<span style="color:#0a8;font-weight:bold">String</span>.valueOf(year);
<span style="color:#080;font-weight:bold">return</span> <span style="color:#0a8;font-weight:bold">String</span>.valueOf(value);
}
}</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">The entity using the bridge</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">[...]
<span style="color:#007">@Indexed</span>
<span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">BlogEntry</span> {
[...]
<span style="color:#007">@Field</span>(store=Store.YES, index=Index.YES)
<span style="color:#007">@FieldBridge</span>(impl=JodaTimeSplitBridge.class)
DateTime creationdate;
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="let-s-query-this-field">
<a class="anchor" href="#let-s-query-this-field"></a>Let’s query this field</h2>
<div class="sectionbody">
<div class="paragraph">
<p>A naive but intuitive query looks like this.</p>
</div>
<div class="listingblock">
<div class="title">Incorrect query</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">QueryBuilder qb = sm.buildQueryBuilderForClass(BlogEntry.class).get();
<span style="color:#0a8;font-weight:bold">Query</span> q = qb.keyword().onField(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">creationdate</span><span style="color:#710">"</span></span>).matching(<span style="color:#080;font-weight:bold">new</span> DateTime()).createQuery();
CacheQuery cq = sm.getQuery(q, BlogEntry.class);
<span style="color:#0a8;font-weight:bold">System</span>.out.println(cq.getResultSize());</code></pre>
</div>
</div>
<div class="paragraph">
<p>Unfortunately that query will always return 0 result.
Can you spot the problem?</p>
</div>
<div class="paragraph">
<p>It turns out that Hibernate Search does not know about these subfields
<code>creationdate.year</code>, <code>creationdate.month</code> and <code>creationdate.day</code>.
A <code>FieldBridge</code> is a bit of a blackbox for the Hibernate Search query DSL,
so it assumes that you index the data in the field name provided by the <code>name</code> parameter
(<code>creationdate</code> in this example).</p>
</div>
<div class="paragraph">
<p>We have plans in a not so future version of Hibernate Search to address that problem.
It will only require you to provide a bit of metadata when you write such advanced custom field bridge.
But that’s the future, so what to do now?</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="use-a-single-field">
<a class="anchor" href="#use-a-single-field"></a>Use a single field</h2>
<div class="sectionbody">
<div class="paragraph">
<p>I am cheating here but as much as you can, try and keep the one property = one field mapping.
Life will be much simpler to you.
In this specific JodaTime type example, this is extremely easy.
Use the custom bridge but instead of creating three fields (for year, month, day),
keep it as a single field in the form of <code>yyyymmdd</code>.</p>
</div>
<div class="paragraph">
<p>Let’s again use our user real life solution.</p>
</div>
<div class="listingblock">
<div class="title">A bridge using one field</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">JodaTimeSingleFieldBridge</span> <span style="color:#088;font-weight:bold">implements</span> TwoWayFieldBridge {
<span style="color:#777">/**
* Store the data in a single field in yyymmdd format
*/</span>
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">void</span> set(<span style="color:#0a8;font-weight:bold">String</span> name, <span style="color:#0a8;font-weight:bold">Object</span> value, <span style="color:#0a8;font-weight:bold">Document</span> document, LuceneOptions luceneoptions) {
DateTime datetime = (DateTime) value;
luceneoptions.addFieldToDocument(
name, datetime.toString(DateTimeFormat.forPattern(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">yyyyMMdd</span><span style="color:#710">"</span></span>)), document
);
}
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#0a8;font-weight:bold">Object</span> get(<span style="color:#0a8;font-weight:bold">String</span> name, <span style="color:#0a8;font-weight:bold">Document</span> document) {
IndexableField strdate = document.getField(name);
<span style="color:#080;font-weight:bold">return</span> DateTime.parse(strdate.stringValue(), DateTimeFormat.forPattern(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">yyyyMMdd</span><span style="color:#710">"</span></span>));
}
<span style="color:#007">@Override</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#0a8;font-weight:bold">String</span> objectToString(<span style="color:#0a8;font-weight:bold">Object</span> date) {
DateTime datetime = (DateTime) date;
<span style="color:#080;font-weight:bold">return</span> datetime.toString(DateTimeFormat.forPattern(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">yyyyMMdd</span><span style="color:#710">"</span></span>));
}
}</code></pre>
</div>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
<div class="paragraph">
<p>In this case, it would even be better to use a Lucene numeric format field.
They are more compact and more efficient at range queries.
Use <code>luceneOptions.addNumericFieldToDocument( name, numericDate, document );</code>.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>The query above will work as expected now.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="but-my-type-must-have-multiple-fields">
<a class="anchor" href="#but-my-type-must-have-multiple-fields"></a>But my type must have multiple fields!</h2>
<div class="sectionbody">
<div class="paragraph">
<p>OK, OK.
I won’t avoid the question.
The solution is to disable the Hibernate Query DSL magic
and target the fields directly.</p>
</div>
<div class="paragraph">
<p>Let’s see how to do it based on the first <code>FieldBridge</code> implementation.</p>
</div>
<div class="listingblock">
<div class="title">Query targeting multiple fields</div>
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#339;font-weight:bold">int</span> year = datetime.getYear();
<span style="color:#339;font-weight:bold">int</span> month = datetime.getMonthOfYear();
<span style="color:#339;font-weight:bold">int</span> day = datetime.getDayOfMonth();
QueryBuilder qb = sm.buildQueryBuilderForClass(BlogEntry.class).get();
<span style="color:#0a8;font-weight:bold">Query</span> q = qb.bool()
.must( qb.keyword().onField(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">creationdate.year</span><span style="color:#710">"</span></span>).ignoreFieldBridge().ignoreAnalyzer()
.matching(year).createQuery() )
.must( qb.keyword().onField(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">creationdate.month</span><span style="color:#710">"</span></span>).ignoreFieldBridge().ignoreAnalyzer()
.matching(month).createQuery() )
.must( qb.keyword().onField(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">creationdate.day</span><span style="color:#710">"</span></span>).ignoreFieldBridge().ignoreAnalyzer()
.matching(day).createQuery() )
.createQuery();
CacheQuery cq = sm.getQuery(q, BlogEntry.class);
<span style="color:#0a8;font-weight:bold">System</span>.out.println(cq.getResultSize());</code></pre>
</div>
</div>
<div class="paragraph">
<p>The key is to:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>target directly each field,</p>
</li>
<li>
<p>disable the field bridge conversion for the query,</p>
</li>
<li>
<p>and it’s probably a good idea to disable the analyzer.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>It’s a rather advanced topic and the query DSL will do the right thing most of the time.
No need to panic just yet.</p>
</div>
<div class="paragraph">
<p>But in case you hit a complex type needs, it’s interesting to understand what is going on underneath.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/23/advanced-embeddable-mappings/Map me if you can - Advanced embeddable mappings2015-07-23T00:00:00Z2015-07-23T00:00:00ZGunnar Morling
The other day I came across an interesting mapping challenge which I thought may be worth sharing. If you are a seasoned JPA user, it will probably be nothing new to you, but those not as experienced may find it helpful :)
TL;DR - JPA let’s you override database columns for embedded objects but also for collections of embedded objects; @AttributeOverride and @AssocationOverride can be used for that.
Let’s assume the following entity model representing a person and their home and business address:
The interesting part is that Person has two associations with Address, one with the "homeAddress" role and another one with...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>The other day I came across an interesting mapping challenge which I thought may be worth sharing. If you are a seasoned JPA user, it will probably be nothing new to you, but those not as experienced may find it helpful :)</p>
</div>
<div class="paragraph">
<p>TL;DR - JPA let’s you override database columns for embedded objects but also for collections of embedded objects; <code>@AttributeOverride</code> and <code>@AssocationOverride</code> can be used for that.</p>
</div>
<div class="paragraph">
<p>Let’s assume the following entity model representing a person and their home and business address:</p>
</div>
<div class="imageblock" style="text-align: center">
<div class="content">
<img src="http://in.relation.to/images/class_diagram_element_collection.png" alt="Entity model">
</div>
</div>
<div class="paragraph">
<p>The interesting part is that <code>Person</code> has two associations with <code>Address</code>, one with the "homeAddress" role and another one with the "businessAddress" role. <code>Address</code> in turn has one ore more address lines.</p>
</div>
<div class="paragraph">
<p>When mapping these types with JPA, <code>Person</code> naturally becomes an entity. As there is a composition relationship between <code>Person</code> and <code>Address</code>, the latter is mapped with <code>@Embeddable</code>. The same goes for <code>AddressLine</code>, which also is an <code>@Embeddable</code>, contained within an element collection owned by <code>Address</code>.</p>
</div>
<div class="paragraph">
<p>So you’d end up with these classes:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#007">@Entity</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Person</span> {
<span style="color:#007">@Id</span>
<span style="color:#088;font-weight:bold">private</span> <span style="color:#339;font-weight:bold">long</span> id;
<span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">String</span> name;
<span style="color:#088;font-weight:bold">private</span> Address homeAddress;
<span style="color:#088;font-weight:bold">private</span> Address businessAddress;
<span style="color:#777">// constructor, getters and setters...</span>
}</code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#007">@Embeddable</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Address</span> {
<span style="color:#088;font-weight:bold">private</span> <span style="color:#339;font-weight:bold">boolean</span> active;
<span style="color:#007">@ElementCollection</span>
<span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">List</span>&lt;AddressLine&gt; lines = <span style="color:#080;font-weight:bold">new</span> <span style="color:#0a8;font-weight:bold">ArrayList</span>&lt;AddressLine&gt;();
<span style="color:#777">// constructor, getters and setters...</span>
}</code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#007">@Embeddable</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">AddressLine</span> {
<span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">String</span> value;
<span style="color:#777">// constructor, getters and setters...</span>
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="code-attributeoverride-code">
<a class="anchor" href="#code-attributeoverride-code"></a><code>@AttributeOverride</code>
</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Let’s fire up a session factory with these types (this uses the brand-new bootstrapping API coming in Hibernate ORM 5) and see how that goes:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">StandardServiceRegistry registry = <span style="color:#080;font-weight:bold">new</span> StandardServiceRegistryBuilder()
.applySetting( AvailableSettings.SHOW_SQL, <span style="color:#069">true</span> )
.applySetting( AvailableSettings.FORMAT_SQL, <span style="color:#069">true</span> )
.applySetting( AvailableSettings.HBM2DDL_AUTO, <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">create-drop</span><span style="color:#710">"</span></span> )
.build();
SessionFactory sessionFactory = <span style="color:#080;font-weight:bold">new</span> MetadataSources( registry )
.addAnnotatedClass( Person.class )
.buildMetadata()
.buildSessionFactory();</code></pre>
</div>
</div>
<div class="paragraph">
<p>Hum, that did not go too well:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">org.hibernate.MappingException: Repeated column in mapping <span style="color:#080;font-weight:bold">for</span> entity:
org.hibernate.bugs.Person column: active (should be mapped with insert=<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">false</span><span style="color:#710">"</span></span> update=<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">false</span><span style="color:#710">"</span></span>)</code></pre>
</div>
</div>
<div class="paragraph">
<p>Of course this makes sense; As <code>Address</code> is embedded twice within <code>Person</code>, its properties must be mapped to unique column names within the <code>Person</code> table. The <a href="http://docs.oracle.com/javaee/7/api/index.html?javax/persistence/AttributeOverride.html">@AttributeOverride</a> annotation can be used for that:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#007">@Entity</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Person</span> {
<span style="color:#007">@Id</span>
<span style="color:#088;font-weight:bold">private</span> <span style="color:#339;font-weight:bold">long</span> id;
<span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">String</span> name;
<span style="color:#007">@AttributeOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">active</span><span style="color:#710">"</span></span>, column = <span style="color:#007">@Column</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">home_address_active</span><span style="color:#710">"</span></span>))
<span style="color:#088;font-weight:bold">private</span> Address homeAddress;
<span style="color:#007">@AttributeOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">active</span><span style="color:#710">"</span></span>, column = <span style="color:#007">@Column</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">business_address_active</span><span style="color:#710">"</span></span>))
<span style="color:#088;font-weight:bold">private</span> Address businessAddress;
<span style="color:#777">// constructor, getters and setters...</span>
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>With that, the session factory boots successfully. But let’s take a look at the tables that get created:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="sql"><span style="color:#B06;font-weight:bold">create</span> <span style="color:#339;font-weight:bold">table</span> Person (
id <span style="color:#0a8;font-weight:bold">bigint</span> <span style="color:#080;font-weight:bold">not</span> <span style="color:#069">null</span>,
business_address_active <span style="color:#0a8;font-weight:bold">boolean</span>,
home_address_active <span style="color:#0a8;font-weight:bold">boolean</span>,
name <span style="color:#0a8;font-weight:bold">varchar</span>(<span style="color:#00D">255</span>),
<span style="color:#088;font-weight:bold">primary</span> <span style="color:#339;font-weight:bold">key</span> (id)
)
<span style="color:#B06;font-weight:bold">create</span> <span style="color:#339;font-weight:bold">table</span> Person_lines (
Person_id <span style="color:#0a8;font-weight:bold">bigint</span> <span style="color:#080;font-weight:bold">not</span> <span style="color:#069">null</span>,
<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">value</span><span style="color:#710">"</span></span> <span style="color:#0a8;font-weight:bold">varchar</span>(<span style="color:#00D">255</span>)
)</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="code-associationoverride-code">
<a class="anchor" href="#code-associationoverride-code"></a><code>@AssociationOverride</code>
</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The <code>Person</code> table looks alright, but there is only a single table for the address lines. That’s a problem as it means there is no way to tell apart the lines of the business address from the lines of the home address when reading back a person from the database.</p>
</div>
<div class="paragraph">
<p>So what to do? <code>@AttributeOverride</code> is of no help this time, as it’s not a single column which needs to be re-defined but an entire table. But luckily, <code>@AttributeOverride</code> has a companion, <a href="http://docs.oracle.com/javaee/7/api/index.html?javax/persistence/AssociationOverride.html">@AssociationOverride</a>. This annotation can be used to configure the required tables in this case:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#007">@Entity</span>
<span style="color:#088;font-weight:bold">public</span> <span style="color:#339;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Person</span> {
<span style="color:#007">@Id</span>
<span style="color:#088;font-weight:bold">private</span> <span style="color:#339;font-weight:bold">long</span> id;
<span style="color:#088;font-weight:bold">private</span> <span style="color:#0a8;font-weight:bold">String</span> name;
<span style="color:#007">@AttributeOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">active</span><span style="color:#710">"</span></span>, column = <span style="color:#007">@Column</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">home_address_active</span><span style="color:#710">"</span></span>))
<span style="color:#007">@AssociationOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">lines</span><span style="color:#710">"</span></span>, joinTable = <span style="color:#007">@JoinTable</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Person_HomeAddress_Line</span><span style="color:#710">"</span></span>))
<span style="color:#088;font-weight:bold">private</span> Address homeAddress;
<span style="color:#007">@AttributeOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">active</span><span style="color:#710">"</span></span>, column = <span style="color:#007">@Column</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">business_address_active</span><span style="color:#710">"</span></span>))
<span style="color:#007">@AssociationOverride</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">lines</span><span style="color:#710">"</span></span>, joinTable = <span style="color:#007">@JoinTable</span>(name = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Person_BusinessAddress_Line</span><span style="color:#710">"</span></span>))
<span style="color:#088;font-weight:bold">private</span> Address businessAddress;
<span style="color:#777">// constructor, getters and setters...</span>
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Et voilà, now you’ll get the DDL for creating the <code>Person</code> table and two different tables for the address lines:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">create table Person (
id bigint not <span style="color:#069">null</span>,
business_address_active <span style="color:#339;font-weight:bold">boolean</span>,
home_address_active <span style="color:#339;font-weight:bold">boolean</span>,
name varchar(<span style="color:#00D">255</span>),
primary key (id)
)
create table Person_BusinessAddress_Line (
Person_id bigint not <span style="color:#069">null</span>,
<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">value</span><span style="color:#710">"</span></span> varchar(<span style="color:#00D">255</span>)
)
create table Person_HomeAddress_Line (
Person_id bigint not <span style="color:#069">null</span>,
<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">value</span><span style="color:#710">"</span></span> varchar(<span style="color:#00D">255</span>)
)</code></pre>
</div>
</div>
</div>
</div>
http://in.relation.to/2015/07/17/hibernate-search-updated-roadmap/Updated Roadmap for Hibernate Search2015-07-17T00:00:00Z2015-07-17T00:00:00ZSanne Grinovero
The Hibernate Search project roadmap was quite outdated, so after some
team chats on IRC and our developer’s mailing list I’ve summarized our plans on the project website.
What’s the plan?
Current 80% progress
Upgrade to Hibernate ORM 5
Coming in Hibernate Search 5.4, which is almost ready,
and you could try it already.
Transactional improvements for the JMS backend
Also included in version 5.4, with improved documentation and configuration examples to follow probably in 5.4.
MassIndexer Improvements
The long standing limitation of transaction timeouts was finally resolved.
Apache Lucene 5 support
We’ve been working on this on separate branches, but we won’t merge it in 5.4 as this branch is stable...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>The <a href="http://hibernate.org/search/roadmap/">Hibernate Search project roadmap</a> was quite outdated, so after some
team chats on IRC and our developer’s mailing list I’ve summarized our plans on the project website.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-s-the-plan">
<a class="anchor" href="#what-s-the-plan"></a>What’s the plan?</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="current-80-progress">
<a class="anchor" href="#current-80-progress"></a>Current 80% progress</h3>
<div class="dlist">
<dl>
<dt class="hdlist1">Upgrade to Hibernate ORM 5</dt>
<dd>
<p>Coming in <code>Hibernate Search 5.4</code>, <a href="http://in.relation.to/2015/07/13/hibernate-search-54CR1/">which is almost ready</a>,
and you could try it already.</p>
</dd>
<dt class="hdlist1"><a href="http://in.relation.to/2015/07/09/hibernate-search-jms-transaction/">Transactional improvements for the JMS backend</a></dt>
<dd>
<p>Also included in version <code>5.4</code>, with improved documentation and configuration examples to follow probably in <code>5.4</code>.</p>
</dd>
<dt class="hdlist1">MassIndexer Improvements</dt>
<dd>
<p>The long standing limitation of transaction timeouts was finally resolved.</p>
</dd>
<dt class="hdlist1">Apache Lucene 5 support</dt>
<dd>
<p>We’ve been working on this on separate branches, but we won’t merge it in <code>5.4</code> as this branch is stable now.
The Lucene 5 update code doesn’t look too scary but we plan that to be <code>5.5</code> 's highlight so that you can focus on one
thing at a time: update to Hibernate ORM 5 now, and just after to Apache Lucene 5.</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>Neither upgrade is particularly complex, but I hope you’ll appreciate the effort to let you update step by step and
take a break in between in case there is some surprise which needs extra attention.</p>
</div>
<div class="paragraph">
<p>Consider that the upgrade to Hibernate ORM 5 implies an upgrade to WildFly 10.</p>
</div>
</div>
<div class="sect2">
<h3 id="near-future-intentions">
<a class="anchor" href="#near-future-intentions"></a>Near Future Intentions</h3>
<div class="dlist">
<dl>
<dt class="hdlist1">Clustering, backends and reliability</dt>
<dd>
<p>We want to make it much simpler for you to use Hibernate Search in a clustered / cloud deployment.
This has been possible since years, but the amount of requests for help are soaring and we have
to admit that we can make several things easier.
This is going to be an ongoing effort, with small improvements like the <a href="https://hibernate.atlassian.net/browse/HSEARCH-1922">usage of JMSXGroupID</a> already in <code>5.4</code>, improved JMS examples in <code>5.5</code>, and the driver for several of the
improvements I’ve listed in the roadmap for <code>5.6</code>…​ however depending on your help and feedback you could read
that as <em>"5.6 and beyond"</em>.</p>
</dd>
<dt class="hdlist1">Java 8, Java 9, …​</dt>
<dd>
<p>With Java 8 very popular and Java 9 getting closer I hope that roadmap items such as <em>out of the box indexing for the new Date/Time types</em> don’t need any explanation. They could use some help though!
We made it <a href="http://docs.jboss.org/hibernate/search/5.4/reference/en-US/html_single/#_bridgeprovider_associate_a_bridge_to_a_given_return_type">easy to register new bridges for any type</a> so you can define your own custom types and define how they should best be indexed; this implies you can make an independent plug-in package for any type we don’t support yet, and if it’s a popular type like the ones from JSR 310 or JSR 354 we’d love to integrate it.</p>
</dd>
<dt class="hdlist1">ElasticSearch and Apache Solr</dt>
<dd>
<p>There has been interest in such integrations for a while, but we failed to make any progress as the problem needs to be broken down in smaller steps.
Several points on <a href="https://hibernate.atlassian.net/projects/HSEARCH">JIRA</a> and <a href="http://hibernate.org/search/roadmap/">the roadmap</a> might seem only tangential but resolve roadblocks and pave the road to integrate Hibernate with such services.
While we’re intimately familiar with Apache Lucene and these <em>Lucene-as-a-service</em> alternatives provide similar features,
we don’t have direct experience with these, so some help will be appreciated.
The plan is to prefer merging small iterative improvements over stalling development for months,
so we’ll see several steps in a <code>5.6+</code> series and use that as the foundation to assess how we can deal
with API inconsistencies across these slightly different backends.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="next">
<a class="anchor" href="#next"></a>Next!</h3>
<div class="paragraph">
<p>After having all the above-listed new features nicely chiseled in our current stable API, I’m confident
that to make the most of features like the ElasticSearch integration we’ll need to make changes to the API.
This last refinement step will define <code>Hibernate Search 6.0</code>.</p>
</div>
<div class="paragraph">
<p>As always, these plans might need to change and we’ll always look forward to your suggestions.
I’m unable to commit on dates or seasons; I would love to see this all happen before this winter but we’ll need your
contribution for that to be realistic.</p>
</div>
</div>
</div>
</div>
http://in.relation.to/2015/07/15/intellij-idea-mac-and-orm/IntelliJ IDEA, Mac OS X and Hibernate ORM2015-07-15T00:00:00Z2015-07-15T00:00:00ZEmmanuel Bernard
Hibernate ORM, IntelliJ IDEA and Mac OS X have been a pretty tough combination to work with
since our move to Gradle.
It’s not exactly anyone’s fault but the combination of
gradle / IntelliJ integration
JDK 6 running IntelliJ IDEA
Hibernate ORM advanced use of Gradle and of custom plugins
made for a long and painful journey.
These days are over.
Steve found the last blocking issue and you can now import Hibernate ORM natively in IntelliJ IDEA.
Importing Hibernate ORM in IntelliJ IDEA on Mac OS X
git clone git@github.com:hibernate/hibernate-orm.git
Open IntelliJ IDEA
File → Open
Select hibernate-orm
The defaults should be good
Make especially sure that you select Use default gradle wrapper
I use...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Hibernate ORM, IntelliJ IDEA and Mac OS X have been a pretty tough combination to work with
since our move to Gradle.
It’s not exactly anyone’s fault but the combination of</p>
</div>
<div class="ulist">
<ul>
<li>
<p>gradle / IntelliJ integration</p>
</li>
<li>
<p>JDK 6 running IntelliJ IDEA</p>
</li>
<li>
<p>Hibernate ORM advanced use of Gradle and of custom plugins</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>made for a long and painful journey.</p>
</div>
<div class="paragraph">
<p>These days are over.
Steve found the last blocking issue and you can now import Hibernate ORM natively in IntelliJ IDEA.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="importing-hibernate-orm-in-intellij-idea-on-mac-os-x">
<a class="anchor" href="#importing-hibernate-orm-in-intellij-idea-on-mac-os-x"></a>Importing Hibernate ORM in IntelliJ IDEA on Mac OS X</h2>
<div class="sectionbody">
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="bash">git clone git@github.com:hibernate/hibernate-orm.git</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>Open <a href="https://www.jetbrains.com/idea/download/">IntelliJ IDEA</a></p>
</li>
<li>
<p><code>File → Open</code></p>
</li>
<li>
<p>Select <code>hibernate-orm</code></p>
</li>
<li>
<p>The defaults should be good</p>
<div class="ulist">
<ul>
<li>
<p>Make especially sure that you select <code>Use default gradle wrapper</code></p>
</li>
<li>
<p>I use Gradle JVM to 1.8</p>
</li>
</ul>
</div>
</li>
<li>
<p>Click OK and let it work and download the internet</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>You now have a properly imported Hibernate ORM project :)</p>
</div>
<div class="paragraph">
<p>This worked on Mac OS X 10.10.4 and IntelliJ IDEA CE 14.1.4.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="importing-hibernate-orm-in-netbeans-on-mac-os-x">
<a class="anchor" href="#importing-hibernate-orm-in-netbeans-on-mac-os-x"></a>Importing Hibernate ORM in NetBeans on Mac OS X</h2>
<div class="sectionbody">
<div class="paragraph">
<p>And this incidentally fixed an import bug for NetBeans.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Open <a href="https://netbeans.org/downloads/index.html">NetBeans</a></p>
</li>
<li>
<p>Install the Gradle plugin</p>
</li>
<li>
<p><code>Open project</code></p>
</li>
<li>
<p>Select <code>hibernate-orm</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>This worked on Mac OS X 10.10.4 and NetBeans 8.0.2.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/13/hibernate-search-54CR1/Hibernate Search is ready for Hibernate ORM 52015-07-13T00:00:00Z2015-07-13T00:00:00ZSanne Grinovero
Hibernate Search version 5.4.0.CR1 is now available! It was built and tested with Hibernate ORM 5.0.0.CR2,
essentially it’s all ready for ORM 5 and we’ll just be waiting for this to be marked Final.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.4.0.CR1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.0.CR2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.0.CR2</version>
</dependency>
No longer timeouts when using the MassIndexer in a container
You can now have the MassIndexer set a different timeout for the internal transactions it will start,
so if you’re running Hibernate Search in...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Hibernate Search version <code>5.4.0.CR1</code> is now available! It was built and tested with Hibernate ORM <code>5.0.0.CR2</code>,
essentially it’s all ready for ORM 5 and we’ll just be waiting for this to be marked <code>Final</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span style="color:#070;font-weight:bold">&lt;dependency&gt;</span>
<span style="color:#070;font-weight:bold">&lt;groupId&gt;</span>org.hibernate<span style="color:#070;font-weight:bold">&lt;/groupId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;artifactId&gt;</span>hibernate-search-orm<span style="color:#070;font-weight:bold">&lt;/artifactId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;version&gt;</span>5.4.0.CR1<span style="color:#070;font-weight:bold">&lt;/version&gt;</span>
<span style="color:#070;font-weight:bold">&lt;/dependency&gt;</span>
<span style="color:#070;font-weight:bold">&lt;dependency&gt;</span>
<span style="color:#070;font-weight:bold">&lt;groupId&gt;</span>org.hibernate<span style="color:#070;font-weight:bold">&lt;/groupId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;artifactId&gt;</span>hibernate-core<span style="color:#070;font-weight:bold">&lt;/artifactId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;version&gt;</span>5.0.0.CR2<span style="color:#070;font-weight:bold">&lt;/version&gt;</span>
<span style="color:#070;font-weight:bold">&lt;/dependency&gt;</span>
<span style="color:#070;font-weight:bold">&lt;dependency&gt;</span>
<span style="color:#070;font-weight:bold">&lt;groupId&gt;</span>org.hibernate<span style="color:#070;font-weight:bold">&lt;/groupId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;artifactId&gt;</span>hibernate-entitymanager<span style="color:#070;font-weight:bold">&lt;/artifactId&gt;</span>
<span style="color:#070;font-weight:bold">&lt;version&gt;</span>5.0.0.CR2<span style="color:#070;font-weight:bold">&lt;/version&gt;</span>
<span style="color:#070;font-weight:bold">&lt;/dependency&gt;</span></code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="no-longer-timeouts-when-using-the-massindexer-in-a-container">
<a class="anchor" href="#no-longer-timeouts-when-using-the-massindexer-in-a-container"></a>No longer timeouts when using the MassIndexer in a container</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You can now have the <code>MassIndexer</code> set a different timeout for the internal transactions it will start,
so if you’re running Hibernate Search in a container like WildFly you no longer have to make a choice
between having a deadline of 5 minutes or changing the default timeout of the whole container.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">fullTextSession
.createIndexer( User.class )
.transactionTimeout( <span style="color:#00D">1800</span> ) <span style="color:#777">//seconds</span>
.startAndWait();</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="great-improvements-in-the-jms-backend">
<a class="anchor" href="#great-improvements-in-the-jms-backend"></a>Great improvements in the JMS backend</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="transactional-jms-backend">
<a class="anchor" href="#transactional-jms-backend"></a>Transactional JMS backend</h3>
<div class="paragraph">
<p>As explained in more detail in <a href="http://in.relation.to/2015/07/09/hibernate-search-jms-transaction/">last week’s post</a>,
Hibernate Search now provides an option to include its indexing operations within the same transaction as the RDBMS.</p>
</div>
<div class="paragraph">
<p>See also the <a href="http://docs.jboss.org/hibernate/search/5.4/reference/en-US/html_single/#search-architecture-jms">JMS Architecture documentation</a>
and the <a href="http://docs.jboss.org/hibernate/search/5.4/reference/en-US/html_single/#jms-backend">JMS slave nodes configuration properties</a>.</p>
</div>
<div class="paragraph">
<p>In short, it’s enabled by setting this property:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code>hibernate.search.worker.enlist_in_transaction=true</code></pre>
</div>
</div>
<div class="paragraph">
<p>But keep in mind: it’s a global setting! If you want to use it, all your backends shall be set to use an
XA enabled, transactional JMS queue.</p>
</div>
<div class="paragraph">
<p>Please let us know if you have a great use case which would require us to allow some form of mixed mode.</p>
</div>
</div>
<div class="sect2">
<h3 id="the-jms-message-header-jmsxgroupid">
<a class="anchor" href="#the-jms-message-header-jmsxgroupid"></a>The JMS message header JMSXGroupID</h3>
<div class="paragraph">
<p>Hibernate Search will now use the specific <code>JMSXGroupID</code> message header and set it to the index name.
That will allow users of the JMS backend to take advantage of <strong>message grouping</strong>.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="modules-versions-and-running-in-wildfly">
<a class="anchor" href="#modules-versions-and-running-in-wildfly"></a>Modules versions and running in WildFly</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The first WildFly version to use Hibernate ORM 5 is version <code>10.0.0.Alpha5</code>,
which was released the past weekend.
So the JBoss Modules we create for this appserver are targeting now WildFly 10,
but at least version <code>10.0.0.Alpha5</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="where-to-download-it-from">
<a class="anchor" href="#where-to-download-it-from"></a>Where to download it from</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Everything you need is available on Hibernate Search’s <a href="http://hibernate.org/search/">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.4.0.CR1">full distribution from here</a>,
or get it from Maven Central, and don’t hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9">forums</a></p>
</div>
</div>
</div>
http://in.relation.to/2015/07/09/hibernate-orm-500-cr2-release/Second Candidate Release for 5.02015-07-09T00:00:00Z2015-07-09T00:00:00ZSteve Ebersole
The second candidate release for Hibernate ORM 5.0. CR2 was required because of a bug in how class-loading
worked in certain managed JPA environments. The details can be found in HHH-9887. The main changes
since CR1 include:
Corrected ClassLoader usage
This is the blocking issue mentioned above. The problem would occur in environments passing a "temp ClassLoader" into
Hibernate via the JPA integration SPI (javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader) and manifest itself
as ClassCastExceptions.
Second-level caching SPI improvement
The second-level caching SPI was improved, allowing the caching providers to generate cache keys.
This includes the addition of the following methods:
org.hibernate.cache.spi.access.EntityRegionAccessStrategy#generateCacheKey
org.hibernate.cache.spi.access.CollectionRegionAccessStrategy#generateCacheKey
org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy#generateCacheKey
Improved cache-by-reference support
For those making use of caching immutable entities by reference...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>The second candidate release for Hibernate ORM 5.0. CR2 was required because of a bug in how class-loading
worked in certain managed JPA environments. The details can be found in <a href="https://hibernate.atlassian.net/browse/HHH-9887">HHH-9887</a>. The main changes
since CR1 include:</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="corrected-classloader-usage">
<a class="anchor" href="#corrected-classloader-usage"></a>Corrected ClassLoader usage</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This is the blocking issue mentioned above. The problem would occur in environments passing a "temp ClassLoader" into
Hibernate via the JPA integration SPI (<code>javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader</code>) and manifest itself
as <code>ClassCastExceptions</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="second-level-caching-spi-improvement">
<a class="anchor" href="#second-level-caching-spi-improvement"></a>Second-level caching SPI improvement</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The second-level caching SPI was improved, allowing the caching providers to generate cache keys.
This includes the addition of the following methods:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>org.hibernate.cache.spi.access.EntityRegionAccessStrategy#generateCacheKey</code></p>
</li>
<li>
<p><code>org.hibernate.cache.spi.access.CollectionRegionAccessStrategy#generateCacheKey</code></p>
</li>
<li>
<p><code>org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy#generateCacheKey</code></p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="improved-cache-by-reference-support">
<a class="anchor" href="#improved-cache-by-reference-support"></a>Improved cache-by-reference support</h2>
<div class="sectionbody">
<div class="paragraph">
<p>For those making use of caching immutable entities by reference (rather than by "disassembled" state), an additional performance improvement is included in CR2.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="ability-to-disable-auto-quoting-of-keyword-as-identifier">
<a class="anchor" href="#ability-to-disable-auto-quoting-of-keyword-as-identifier"></a>Ability to disable auto-quoting of keyword-as-identifier</h2>
<div class="sectionbody">
<div class="paragraph">
<p>A new feature in 5.0 is the automatic quoting of identifiers that are believed to be keywords in the underlying database.
As this support is new, often the Dialects are too aggressive in what they deem to be keywords.
Thus we added a new setting to disable this behavior if it causes problems in your application.
This can be controlled by specifying <code>hibernate.auto_quote_keyword</code> as false in configuration settings.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="significantly-improved-bytecode-enhancement-support">
<a class="anchor" href="#significantly-improved-bytecode-enhancement-support"></a>Significantly improved bytecode enhancement support</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Including:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>added ability for automatic management of bi-directional associations</p>
</li>
<li>
<p>self-contained dirty state tracking (more efficient flushing), including switchable algorithms for dirty determination</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="odds-n-ends">
<a class="anchor" href="#odds-n-ends"></a>Odds-n-ends</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Additionally many other improvements and bugfixes are included. See <a href="https://hibernate.atlassian.net/projects/HHH/versions/20150">the changelogs</a> for the complete list of changes.</p>
</div>
<div class="paragraph">
<p>The release tag is available on <a href="https://github.com/hibernate/hibernate-orm/releases/tag/5.0.0.CR2">GitHub</a>.</p>
</div>
<div class="paragraph">
<p>As always, see <a href="http://hibernate.org/orm/downloads/" class="bare">http://hibernate.org/orm/downloads/</a> for information on obtaining the releases.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/09/hibernate-search-jms-transaction/Hibernate Search, JMS and transactions2015-07-09T00:00:00Z2015-07-09T00:00:00ZEmmanuel Bernard
Hibernate Search sends the indexing requests in the post transaction phase.
Until now.
The JMS backend can now send its indexing requests transactionally with the database changes.
Why is that useful? Read on.
A bit of context
When you change indexed entities,
Hibernate Search collects these changes during the database transaction.
It then waits for the transaction to be successful before pushing them to the backend.
Hibernate Search has a few backends:
lucene: this one uses Lucene to index the entities
JMS: this one sends a JMS message with the list of index changes.
This JMS queue is then read by a master which uses the Lucene backend.
and a few more...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Hibernate Search sends the indexing requests in the post transaction phase.
Until now.
The JMS backend can now send its indexing requests <em>transactionally</em> with the database changes.
Why is that useful? Read on.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="a-bit-of-context">
<a class="anchor" href="#a-bit-of-context"></a>A bit of context</h2>
<div class="sectionbody">
<div class="paragraph">
<p>When you change indexed entities,
Hibernate Search collects these changes during the database transaction.
It then waits for the <strong>transaction to be successful before pushing them</strong> to the backend.</p>
</div>
<div class="paragraph">
<p>Hibernate Search has a few backends:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>lucene</code>: this one uses Lucene to index the entities</p>
</li>
<li>
<p><code>JMS</code>: this one sends a JMS message with the list of index changes.
This JMS queue is then read by a master which uses the Lucene backend.</p>
</li>
<li>
<p>and a few more that are not interesting here</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Running the backend after the transaction (in the <code>afterTransaction</code> phase to be specific)
is generally what you want.
Just to name a few reasons:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>you don’t want index changes to be executed if you end up rollbacking the database transaction</p>
</li>
<li>
<p>you don’t necessarily want your database changes to fail because the indexing fails:
you can always rebuild the index from your database.</p>
</li>
<li>
<p>and most backends don’t support transactions anyways</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Hibernate Search lets you enlist an <strong>error callback</strong>
so that you are notified of these indexing problems when they happen
and react the way you want (log, raise an exception, retry etc).</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="so-why-make-the-jms-backend-join-the-transaction">
<a class="anchor" href="#so-why-make-the-jms-backend-join-the-transaction"></a>So why make the JMS backend join the transaction</h2>
<div class="sectionbody">
<div class="paragraph">
<p>If you make the JMS backend join the transaction,
then either the database changes happen and the JMS messages are received by the queue,
or nothing happens (no database change and no JMS message).</p>
</div>
<div class="paragraph">
<p>The non transactional approach is still our recommended approach.
But there are a few reasons why you want to go transactional.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">No code to handle the message failure</dt>
<dd>
<p>It eliminates the need to write an error callback and handle this problematic case.</p>
</dd>
<dt class="hdlist1">Simpler exploitation processes</dt>
<dd>
<p>It simplifies your exploitation processes.
You can focus on monitoring your JMS queue (rates of messages coming in, rates of messages coming out)
which will give you an accurate status of the health of Hibernate Search’s work.</p>
</dd>
<dt class="hdlist1">Transactional mass indexing</dt>
<dd>
<p>When doing changes to lots of indexed entities,
it is common to use the following pseudo pattern to avoiod <code>OutOfMemoryException</code></p>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span style="color:#080;font-weight:bold">for</span> (<span style="color:#339;font-weight:bold">int</span> i = <span style="color:#00D">0</span> ; i &lt; workLoadSize ; i++) {
<span style="color:#777">// do changes</span>
<span style="color:#080;font-weight:bold">if</span> ( i % <span style="color:#00D">500</span> == <span style="color:#00D">0</span> ) {
fullTextSession.flush();
fullTextSession.flushToIndexes();
fullTextSession.clear();
}
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you use the transactional JMS backend, then all the message will be sent or none of them.</p>
</div>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Make sure your JMS implementation and your JTA transaction manager are smart and don’t keep the messages in memory
or you might face an <code>OutOfMemoryException</code>.</p>
</div>
</td>
</tr>
</table>
</div>
</dd>
<dt class="hdlist1">More consistent batching frameworks flow</dt>
<dd>
<p>If you use a batching framework like Spring Batch which keeps its "done" status in a database,
you have a guarantee that changes, indexing requests and batch status are all consistent.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-to-use-the-feature">
<a class="anchor" href="#how-to-use-the-feature"></a>How to use the feature</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This <a href="https://hibernate.atlassian.net/browse/HSEARCH-668">feature</a> is now integrated in master
and will be in an Hibernate Search release any time soon.</p>
</div>
<div class="paragraph">
<p>We kept the configuration as simple as possible.
Simply add the following property</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code>hibernate.search.worker.enlist_in_transaction=true</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you try and use this option on a non transactional backend (i.e. not JMS),
Hibernate Search will yell at you.</p>
</div>
<div class="paragraph">
<p>Make sure to use a XA JMS queue
and that your database supports XA as we are talking about coordinated transactional systems.</p>
</div>
<div class="paragraph">
<p>Many thanks to Yoann, one of our customers, who helped us refine the why and how of that feature.</p>
</div>
</div>
</div>
http://in.relation.to/2015/07/07/vjbug-on-lucene-on-javaee/Lucene for Java EE developers virtual user group2015-07-07T00:00:00Z2015-07-07T00:00:00ZEmmanuel Bernard
Sanne is going to do a virtual JBoss User Group session Tuesday July 14th at 6PM BST / 5PM UTC / 1PM EDT / 10 AM PDT.
He is going to talk about Lucene in Java EE.
He will also describe some projects dear to our heart.
If you want to know what Hibernate Search, Infinispan bring to the Lucene table and how they use Lucene internally,
that’s the event to be in!
Apache Lucene is the de-facto standard open source library for Java developers to implement full-text-search capabilities.
While it’s thriving in its field, it is rarely mentioned in the scope of Java EE development.
In...
<div class="paragraph">
<p>Sanne is going to do a virtual JBoss User Group session Tuesday July 14th at 6PM BST / 5PM UTC / 1PM EDT / 10 AM PDT.
He is going to talk about <strong>Lucene in Java EE</strong>.</p>
</div>
<div class="paragraph">
<p>He will also describe some projects dear to our heart.
If you want to know what Hibernate Search, Infinispan bring to the Lucene table and how they use Lucene internally,
that’s the event to be in!</p>
</div>
<div class="quoteblock">
<blockquote>
<div class="paragraph">
<p>Apache Lucene is the de-facto standard open source library for Java developers to implement full-text-search capabilities.</p>
</div>
<div class="paragraph">
<p>While it’s thriving in its field, it is rarely mentioned in the scope of Java EE development.</p>
</div>
<div class="paragraph">
<p>In this talk we will see for which features many developers love Lucene, make some concrete examples of common problems it elegantly solves, and see some best practices about using it in a Java EE stack.</p>
</div>
<div class="paragraph">
<p>Finally we’ll see how some popular OSS projects such as Hibernate ORM (JPA provider), WildFly (Java EE runtime) and Infinispan (in-memory datagrid, JCache implementor) actually provide great Lucene integration capabilities.</p>
</div>
</blockquote>
</div>
<div class="paragraph">
<p>If you are interested,
get some more info on <a href="http://www.meetup.com/JBoss-User-Group-Worldwide/events/220482490/">Meetup</a>
and enlist.</p>
</div>
http://in.relation.to/2015/06/26/multitenancy-and-current-session/Multitenancy and current session2015-06-26T00:00:00Z2015-06-26T00:00:00ZEmmanuel Bernard
Today let’s discuss the interaction between multitenancy and the current session feature.
Multitenancy let’s you isolate Session operations between different tenants.
This is useful to create a single application isolating different customers from one another.
The current session feature returns the same session for a given context, typically a (JTA) transaction.
This facilitates the one session per view/transaction/conversation pattern and avoids the one session per operation anti-pattern.
Session session = sessionFactory.getCurrentSession();
// do some other work
[...]
// later in the same context (e.g. JTA Transaction)
Session session2 = sessionFactory.getCurrentSession();
// semantically we have
assert session == session2
The two features work well together,
simply implement
CurrentTenantIdentifierResolver.
That will give Hibernate ORM the expected...
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Today let’s discuss the interaction between multitenancy and the <em>current session</em> feature.</p>
</div>
<div class="paragraph">
<p>Multitenancy let’s you isolate <code>Session</code> operations between different tenants.
This is useful to create a single application isolating different customers from one another.</p>
</div>
<div class="paragraph">
<p>The <em>current session</em> feature returns the same session for a given context, typically a (JTA) transaction.
This facilitates the one session per view/transaction/conversation pattern and avoids the one session per operation anti-pattern.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">Session session = sessionFactory.getCurrentSession();
<span style="color:#777">// do some other work</span>
[...]
<span style="color:#777">// later in the same context (e.g. JTA Transaction)</span>
Session session2 = sessionFactory.getCurrentSession();
<span style="color:#777">// semantically we have</span>
<span style="color:#080;font-weight:bold">assert</span> session == session2</code></pre>
</div>
</div>
<div class="paragraph">
<p>The two features work well together,
simply implement
<a href="http://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html_single/#d5e4871">CurrentTenantIdentifierResolver</a>.
That will give Hibernate ORM the expected tenant id when the current session is created.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="how-current-is-current">
<a class="anchor" href="#how-current-is-current"></a>How current is current?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>When discussing with Florian and the <a href="http://www.toulousejug.org">ToulouseJUG</a>,
we exchanged on a small case where things might not work as you expect.
Hibernate ORM considers that, for a given context (e.g. transaction),
there can only be a single current <code>Session</code>.</p>
</div>
<div class="paragraph">
<p>So if in the same context (e.g. transaction):</p>
</div>
<div class="ulist">
<ul>
<li>
<p>your <code>CurrentTenantIdentifierResolver</code> implementation returns different values of tenant id,</p>
</li>
<li>
<p>you use <code>getCurrentSession()</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>you will get a <code>TenantIdentifierMismatchException</code>.</p>
</div>
<div class="paragraph">
<p>However, it is sometimes useful to be able to reach several tenants from the same context.
You have two options:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Manually create the <code>Session</code></p>
</li>
<li>
<p>Implement a custom <code>CurrentSessionContext</code></p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="manually-create-the-code-session-code">
<a class="anchor" href="#manually-create-the-code-session-code"></a>Manually create the <code>Session</code>
</h2>
<div class="sectionbody">
<div class="paragraph">
<p>You can use the <code>SessionFactory</code> API to create a <code>Session</code> for the tenant id you are looking for.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java">Session session1 = sessionFactory.withOptions()
.tenantIdentifier( tenant1 )
...
.openSession();
Session session2 = sessionFactory.withOptions()
.tenantIdentifier( tenant2 )
...
.openSession();</code></pre>
</div>
</div>
<div class="paragraph">
<p>But you have to make sure to close these sessions.
If you are used to CDI or Spring handling sessions for you,
or if you rely on the current session feature to propagate the session across your stack,
this might be annoying.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="implement-a-custom-code-currentsessioncontext-code">
<a class="anchor" href="#implement-a-custom-code-currentsessioncontext-code"></a>Implement a custom <code>CurrentSessionContext</code>
</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The alternative is to implement your own version of <code>CurrentSessionContext</code>,
avoid raising the <code>TenantIdentifierMismatchException</code>,
and keep <code>Session</code> instances per both context and tenant id.</p>
</div>
<div class="paragraph">
<p>In practice, current sessions are stored in a <code>ConcurrentHashMap</code> keyed by context identifier,
you just need to improve that part.
Start with <a href="https://github.com/hibernate/hibernate-orm/blob/d0c2c31ab7217da32eee2a82457eb321a3aebbaa/hibernate-core/src/main/java/org/hibernate/context/internal/JTASessionContext.java">JTASessionContext</a>
and hack away!</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="what-now">
<a class="anchor" href="#what-now"></a>What now?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We are currently discussing whether the default <code>CurrentSessionContext</code> implementations
should partition by tenant id or raise the exception.
If you have your opinion, <a href="https://hibernate.atlassian.net/browse/HHH-9766">chime in</a>!</p>
</div>
<div class="paragraph">
<p>In the mean time, use one of the options above.</p>
</div>
</div>
</div>
http://in.relation.to/2015/06/26/hibernate-test-case-templates/Hibernate Test Case Templates2015-06-26T00:00:00Z2015-06-26T00:00:00ZBrett Meyer
When creating a bug report for any project within the Hibernate family, it’s extremely helpful (and, frankly, required)
to have an adequate test case available. This is obviously important to make reproducing the issue as easy as possible.
But it’s also vital longer-term. Nearly every bug fix should include a regression test, which is frequently based on the
original reproducer (sometimes, it’s the reproducer, verbatim).
To help create useful test cases, we’re opening up a repo with various templates. Please see the READMEs in each
project’s subdir for more info: Hibernate Test Case Templates
As a starting point, the repo contains two templates for ORM:
ORMUnitTestCase: By...
<div class="paragraph">
<p>When creating a bug report for any project within the Hibernate family, it’s extremely helpful (and, frankly, required)
to have an adequate test case available. This is obviously important to make reproducing the issue as easy as possible.
But it’s also vital longer-term. Nearly every bug fix should include a regression test, which is frequently based on the
original reproducer (sometimes, it’s the reproducer, verbatim).</p>
</div>
<div class="paragraph">
<p>To help create useful test cases, we’re opening up a repo with various templates. Please see the READMEs in each
project’s subdir for more info: <a href="https://github.com/hibernate/hibernate-test-case-templates">Hibernate Test Case Templates</a></p>
</div>
<div class="paragraph">
<p>As a starting point, the repo contains two templates for ORM:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>ORMUnitTestCase</code>: By far, this one’s the most helpful. ORM includes a built-in unit test framework that does much of
the heavy lifting for you. All that’s required is your entities, logic, and any necessary settings. Since we nearly
always include a regression test with bug fixes, providing your reproducer using this method simplifies the process. We
can then directly commit it, without having to mold it in first. What’s even better? Fork hibernate-orm itself, add your
test case directly to a module’s unit tests (using the template class), then submit it as a PR!</p>
</li>
<li>
<p><code>ORMStandaloneTestCase</code>: This template is standalone and will look familiar. It simply uses a run-of-the-mill ORM setup.
Although it’s perfectly acceptable as a reproducer, lean towards <code>ORMUnitTestCase</code> whenever possible.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The eventual goal is to also include templates for Validator, Search, and OGM.</p>
</div>
<div class="paragraph">
<p>As always, this is open source for a reason! If the templates can be improved in any way, please let us know (either
through our JIRA instance or through GitHub Issues). Better yet, send us a pull request!</p>
</div>
http://in.relation.to/2015/06/25/blog-revamped/Revamped blog2015-06-25T00:00:00Z2015-06-25T00:00:00ZEmmanuel Bernard
Welcome to the newly revamped Hibernate and friends blog.
As you can see, we made it look like hibernate.org
and we took the opportunity to clean up the tags to make them more useful.
But we had other reasons to migrate.
Blog early, blog often
We have been very happy with the Asciidoctor-based writing experience
of both our reference documentation and of hibernate.org.
We are bringing this ease of writing to our blog and the not so secret objective is for us to blog more.
So if you don’t see more content here, you can start yelling at us :)
Write once, display anywhere
There is an added bonus to...
<div class="paragraph">
<p>Welcome to the newly revamped Hibernate and friends blog.</p>
</div>
<div class="paragraph">
<p>As you can see, we made it look like <a href="http://hibernate.org" class="bare">hibernate.org</a>
and we took the opportunity to clean up the tags to make them more useful.
But we had other reasons to migrate.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Blog early, blog often</dt>
<dd>
<p>We have been very happy with the <a href="http://asciidoctor.org">Asciidoctor</a>-based writing experience
of both our reference documentation and of <a href="http://hibernate.org" class="bare">hibernate.org</a>.
We are bringing this ease of writing to our blog and the not so secret objective is for us to blog more.
So if you don’t see more content here, you can start yelling at us :)</p>
</dd>
<dt class="hdlist1">Write once, display anywhere</dt>
<dd>
<p>There is an added bonus to using Asciidoctor for all of our writing:
we can move content easily between systems.
What starts as a blog can easily become a how-to page on the site or a section in the reference documentation.</p>
</dd>
<dt class="hdlist1">Maintenance</dt>
<dd>
<p>We had a few issues with the old infrastructure
that were keeping us away from our IDEs a bit too often for comfort. <br>
This blog is a statically generated site, we use <a href="http://awestruct.org">Awestruct</a>.
This means that we can make is scale very easily and with very low maintenance.
Nothing beats plain old HTML :)</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>We did migrate all the old entries and comments from the old blog:
fear not, nothing is lost.</p>
</div>
<div class="paragraph">
<p>If you seen any issue, let us know in the comments or by <a href="https://twitter.com/hibernate">tweet</a>.
Oh and enlist to our new <a href="http://in.relation.to/blog.atom">feed URL</a>.</p>
</div>
http://in.relation.to/2015/06/10/hibernate-search-530-final-now-available/Hibernate Search 5.3.0.Final now available!2015-06-10T00:00:00Z2015-06-10T00:00:00ZSanne Grinovero
As suggested last week, today we released Hibernate Search version 5.3.0.Final.
Compared to the previous candidate release, the only changes are some minor clarifications in the documentation.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.3.0.Final</version>
</dependency>
Faceting API changes
The new great faceting integration comes at a small migration cost: remember you now need to use the new @Facet annotation as explained in the the example of the previous post.
What's next?
Barring some maintenance needs on this branch 5.3, we have no plans of other Hibernate Search releases to...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
As suggested <a href="http://in.relation.to/2015/06/02/the-new-faceting-engine-gets-closer-hibernate-search-530-cr-1-released" target="" class="regularLink">last week</a>, today we released Hibernate Search version <i class="wikiEmphasis">5.3.0.Final</i>.
</p>
<p class="wikiPara">
Compared to the previous candidate release, the only changes are some minor clarifications in the documentation.
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;"> &lt;dependency&gt;
&lt;groupId&gt;org.hibernate&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-search-orm&lt;/artifactId&gt;
&lt;version&gt;5.3.0.Final&lt;/version&gt;
&lt;/dependency&gt;</pre>
<h3 class="wikiHeadline2" id="H-FacetingAPIChanges"><a href="http://in.relation.to/2015/06/10/hibernate-search-530-final-now-available#H-FacetingAPIChanges">Faceting API changes</a></h3>
<p class="wikiPara">
The new great faceting integration comes at a small migration cost: remember you now need to use the new <tt>@Facet</tt> annotation as explained in the <a href="http://in.relation.to/2015/05/11/hibernate-search-530-beta-1-with-native-lucene-faceting" target="" class="regularLink">the example of the previous post</a>.
</p>
<h3 class="wikiHeadline2" id="H-WhatsNext"><a href="http://in.relation.to/2015/06/10/hibernate-search-530-final-now-available#H-WhatsNext">What's next?</a></h3>
<p class="wikiPara">
Barring some maintenance needs on this branch <tt>5.3</tt>, we have no plans of other Hibernate Search releases to target Hibernate ORM 4.3.x.
The focus is now on Hibernate 5 compatibility.
</p>
<h3 class="wikiHeadline3" id="H-Links"><a href="http://in.relation.to/2015/06/10/hibernate-search-530-final-now-available#H-Links">Links</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Artefact jars are available on Maven Central under the GAV <u>org.hibernate:hibernate-search-orm:5.3.0.Final</u>
</li>
<li class="wikiUnorderedListItem"> Tarballs and zip bundles can be downloaded from <a href="http://hibernate.org/search/downloads/" target="" class="regularLink">our website</a>
</li>
<li class="wikiUnorderedListItem"> Feedback is welcome on the <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a> and <a href="http://hibernate.org/community/" target="" class="regularLink">emails, IRC</a>
</li>
</ul>
</div>
http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5/First preview of Hibernate Search for Hibernate ORM 52015-06-05T00:00:00Z2015-06-05T00:00:00ZSanne Grinovero
For those of you using Hibernate ORM version 5.0.0.CR1, you can now use the freshly released Hibernate Search 5.4 version 5.4.0.Alpha1.
What's new
Absolutely nothing! This Hibernate Search version is identical in terms of features and API to version 5.3.0.CR1: this should make it easier for you all to upgrade the Hibernate ORM libraries (hibernate-core, hibernate-entitymanager,..) without the distraction of changes because of Hibernate Search: focus on the changes you'll need to apply because of the major version upgrade of Hibernate (if any, as it's not too complex at all).
WildFly compatibility and JBoss Modules
With every release of Hibernate Search we normally also...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
For those of you using <i class="wikiEmphasis">Hibernate ORM version 5.0.0.CR1</i>, you can now use the freshly released Hibernate Search 5.4 version <tt>5.4.0.Alpha1</tt>.
</p>
<h3 class="wikiHeadline2" id="H-WhatsNew"><a href="http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5#H-WhatsNew">What's new</a></h3>
<p class="wikiPara">
Absolutely nothing! This Hibernate Search version is identical in terms of features and API to version <tt>5.3.0.CR1</tt>: this should make it easier for you all to upgrade the Hibernate ORM libraries (<tt>hibernate-core</tt>, <tt>hibernate-entitymanager</tt>,..) without the distraction of changes because of Hibernate Search: focus on the changes you'll need to apply because of the major version upgrade of Hibernate (if any, as it's not too complex at all).
</p>
<h3 class="wikiHeadline2" id="H-WildFlyCompatibilityAndJBossModules"><a href="http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5#H-WildFlyCompatibilityAndJBossModules">WildFly compatibility and JBoss Modules</a></h3>
<p class="wikiPara">
With every release of Hibernate Search we normally also release a set of modules to run the latest version of it on WildFly, but in this case since the updated Hibernate ORM 5 integrations for WildFly have yet to be released, we skipped this step.
Fear not, the WildFly integration will be finished soon and we'll then resume releasing such module packs as usual. Not least, this very same version of Hibernate Search will soon be available in WildFly 10, so the modules missing today won't actually be needed at all.
</p>
<h3 class="wikiHeadline2" id="H-ThisIsAGreatTimeToTryHibernate5"><a href="http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5#H-ThisIsAGreatTimeToTryHibernate5">This is a great time to try Hibernate 5</a></h3>
<p class="wikiPara">
While the latest polish is performed on Hibernate 5, we're all looking forward for feedback from you. It is likely that some more changes will be done, but we consider it good enough already to not expect any regression so please try it and let us know!
We're at that sweet spot in which you can still propose changes without the chains of strong API compatibility requirements, but good enough for you to not be wasting time on a quickly changing target.
</p>
<h3 class="wikiHeadline2" id="H-VersionsReminder"><a href="http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5#H-VersionsReminder">Versions reminder</a></h3>
<p class="wikiPara">
This version of Hibernate Search requires:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Hibernate ORM 5.0.0.CR1</li>
<li class="wikiUnorderedListItem"> Apache Lucene 4.10.x</li>
<li class="wikiUnorderedListItem"> Java SE 7</li>
</ul>
<p class="wikiPara">
Our rules and conventions for versions and compatibility <a href="https://github.com/hibernate/hibernate-orm/wiki/Compatibility-Considerations" target="" class="regularLink">are documented here on the GitHub Wiki</a>.
</p>
<h3 class="wikiHeadline3" id="H-Links"><a href="http://in.relation.to/2015/06/05/first-preview-of-hibernate-search-for-hibernate-orm-5#H-Links">Links</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Artefact jars are available on Maven Central under the GAV <u>org.hibernate:hibernate-search-orm:5.4.0.Alpha1</u>
</li>
<li class="wikiUnorderedListItem"> Zip and tar bundles are available via <a href="http://hibernate.org/search/downloads/" target="" class="regularLink">our website</a>
</li>
<li class="wikiUnorderedListItem"> Feedback is welcome on the <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a> and <a href="http://hibernate.org/community/" target="" class="regularLink">emails, IRC</a>
</li>
</ul>
</div>
http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly/NoSQL with Hibernate OGM: Building a REST application on WildFly2015-06-03T00:00:00Z2015-06-03T00:00:00ZGunnar Morling
Welcome back to our tutorial series “NoSQL with Hibernate OGM”!
In this part you will learn how to use Hibernate OGM from within a Java EE application running on the WildFly server. Using the entity model you already know from the previous parts of this tutorial, we will build a small REST-based application for managing hikes. In case you haven’t read the first two installments of this series, you can find them here:
Persisting your first entities
Querying for your data
In the following you will learn how to prepare WildFly for using it with Hibernate OGM, configure a JPA persistence unit,...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Welcome back to our tutorial series “NoSQL with Hibernate OGM”!
</p>
<p class="wikiPara">
In this part you will learn how to use Hibernate OGM from within a Java EE application running on the WildFly server. Using the <a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-TheDomainModel" target="" class="regularLink">entity model</a> you already know from the previous parts of this tutorial, we will build a small REST-based application for managing hikes. In case you haven’t read the first two installments of this series, you can find them here:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities" target="" class="regularLink">Persisting your first entities</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data" target="" class="regularLink">Querying for your data</a>
</li>
</ul>
<p class="wikiPara">
In the following you will learn how to prepare WildFly for using it with Hibernate OGM, configure a JPA persistence unit, create repository classes for accessing your data and providing REST resources on top of these. In this post we will primarily focus on the aspects related to persistence, so some basic experience with REST/JAX-RS may help. The <a href="https://github.com/hibernate/hibernate-demos/tree/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-3" target="" class="regularLink">complete source code</a> of this tutorial is hosted on GitHub.
</p>
<h3 class="wikiHeadline3" id="H-PreparingWildFly"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-PreparingWildFly">Preparing WildFly</a></h3>
<p class="wikiPara">
The <a href="http://wildfly.org/" target="" class="regularLink">WildFly</a> server runtime is based on the <a href="https://docs.jboss.org/author/display/MODULES/Home" target="" class="regularLink">JBoss Modules</a> system. This provides a modular class-loading environment where each library (such as Hibernate OGM) is its own module, declaring the list of other modules it depends on and only “seeing” classes from those other dependencies. This isolation provides an escape from the dreaded “classpath hell”.
</p>
<p class="wikiPara">
ZIP files containing all the required modules for Hibernate OGM are provided on SourceForge. Hibernate OGM 4.2 - which <a href="http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out" target="" class="regularLink">we released yesterday</a> - supports WildFly 9, so download <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.2.0.Final/hibernate-ogm-modules-wildfly9-4.2.0.Final.zip/download" target="" class="regularLink">hibernate-ogm-modules-wildfly9-4.2.0.Final.zip</a> for that. If you are on WildFly 8, use Hibernate OGM 4.1 and get <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.3.Final/hibernate-ogm-modules-wildfly8-4.1.3.Final.zip/download" target="" class="regularLink">hibernate-ogm-modules-wildfly8-4.1.3.Final.zip</a> instead.
</p>
<p class="wikiPara">
Unzip the archive corresponding to your WildFly version into the <i class="wikiEmphasis">modules</i> directory of the application server. If you prefer that the original WildFly directories remain unchanged, you also can unzip the Hibernate OGM modules archive to any other folder and configure this as the “module path” to be used by the server. To do so, export the following two environment variables, matching your specific environment:
</p>
<pre class="wikiPreformatted">
export JBOSS_HOME=/path/to/wildfly
export JBOSS_MODULEPATH=$JBOSS_HOME/modules:/path/to/ogm/modules</pre>
<p class="wikiPara">
In case you are working with the <a href="https://docs.jboss.org/wildfly/plugins/maven/latest/" target="" class="regularLink">Maven WildFly plug-in</a>, e.g. to launch WildFly during development, you’d achieve the same with the following plug-in configuration in your POM file:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;plugin&gt;
&lt;groupId&gt;org.wildfly.plugins&lt;/groupId&gt;
&lt;artifactId&gt;wildfly-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.1.0.Alpha1&lt;/version&gt;
&lt;configuration&gt;
&lt;jboss-home&gt;/path/to/wildfly&lt;/jboss-home&gt;
&lt;modules-path&gt;/path/to/ogm/modules&lt;/modules-path&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
...</pre>
<h3 class="wikiHeadline3" id="H-SettingUpTheProject"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-SettingUpTheProject">Setting up the project</a></h3>
<p class="wikiPara">
Start by creating a new Maven project using the “war” packaging type. Add the following to your <i class="wikiEmphasis">pom.xml</i>:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-bom&lt;/artifactId&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;version&gt;4.2.0.Final&lt;/version&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
...</pre>
<p class="wikiPara">
This makes sure you get matching versions of Hibernate OGM’s modules and any (optional) dependencies. Then add the dependency to the Java EE 7 API and one of the Hibernate OGM backend modules, e.g. <a href="http://infinispan.org/" target="" class="regularLink">Infinispan</a>, JBoss’ high-performance, distributed key/value data grid (any other such as <i class="wikiEmphasis">hibernate-ogm-mongodb</i> or the brand-new <i class="wikiEmphasis">hibernate-ogm-cassandra</i> module would work as well):
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;javax&lt;/groupId&gt;
&lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
&lt;version&gt;7.0&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-infinispan&lt;/artifactId&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
...</pre>
<p class="wikiPara">
The <tt>provided</tt> scope makes these dependencies available for compilation but prevents them from being added to the resulting WAR file. That it because the Java EE API is part of WildFly already, and Hibernate OGM will be contributed through the modules you unzipped before.
</p>
<p class="wikiPara">
Just adding these modules to the server doesn’t cut it, though. They also need to be registered as a module dependency with the application. To do so, add the file <i class="wikiEmphasis">src/main/webapp/WEB-INF/jboss-web.xml</i> with the following contents:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
&lt;deployment&gt;
&lt;dependencies&gt;
&lt;module name="org.hibernate" slot="ogm" services="import" /&gt;
&lt;module name="org.hibernate.ogm.infinispan" services="import" /&gt;
&lt;module name="org.hibernate.search.orm" services="import" /&gt;
&lt;/dependencies&gt;
&lt;/deployment&gt;
&lt;/jboss-deployment-structure&gt;</pre>
<p class="wikiPara">
This will make Hibernate OGM core and the Infinispan backend as well as <a href="http://hibernate.org/search/" target="" class="regularLink">Hibernate Search</a> available to your application. The latter will be used to run JP-QL queries in a bit.
</p>
<h3 class="wikiHeadline3" id="H-AddingEntityClassesAndRepositories"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-AddingEntityClassesAndRepositories">Adding entity classes and repositories</a></h3>
<p class="wikiPara">
With the basic project infrastructure in place, it’s time to add the entity classes and repository classes for accessing them. The entity types are basically the same as seen in <a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities" target="" class="regularLink">part 1</a>, only now they are annotated with <tt>@Indexed</tt> in order to allow them to be queried via Hibernate Search and Lucene:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
@Indexed
public class Person {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String firstName;
private String lastName;
@OneToMany(
mappedBy = "organizer",
cascade = { CascadeType.PERSIST, CascadeType.MERGE },
fetch = FetchType.EAGER
)
private Set&lt;Hike&gt; organizedHikes = new HashSet&lt;&gt;();
// constructors, getters and setters...
}</pre>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
@Indexed
public class Hike {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String description;
private Date date;
private BigDecimal difficulty;
@ManyToOne
private Person organizer;
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name = "sectionNo")
private List&lt;HikeSection&gt; sections;
// constructors, getters and setters...
}</pre>
<pre class="wikiPreformatted brush: java; gutter: false;">@Embeddable
public class HikeSection {
private String start;
private String end;
// constructors, getters and setters...
}</pre>
<p class="wikiPara">
In order to use these entities, a JPA persistence unit must be defined. To do so, create the file <i class="wikiEmphasis">src/main/resources/META-INF/persistence.xml</i>:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0"&gt;
&lt;persistence-unit name="hike-PU" transaction-type="JTA"&gt;
&lt;provider&gt;org.hibernate.ogm.jpa.HibernateOgmPersistence&lt;/provider&gt;
&lt;class&gt;org.hibernate.ogm.demos.ogm101.part3.model.Person&lt;/class&gt;
&lt;class&gt;org.hibernate.ogm.demos.ogm101.part3.model.Hike&lt;/class&gt;
&lt;properties&gt;
&lt;property name="hibernate.ogm.datastore.provider" value="INFINISPAN" /&gt;
&lt;property name="hibernate.ogm.datastore.database" value="hike_db" /&gt;
&lt;property name="hibernate.ogm.datastore.create_database" value="true" /&gt;
&lt;/properties&gt;
&lt;/persistence-unit&gt;
&lt;/persistence&gt;</pre>
<p class="wikiPara">
Here we define a persistence unit named “hike-PU”. Infinispan is a fully transactional datastore, and using JTA as transaction type allows the persistence unit to participate in container-managed transactions. Specifying <tt>HibernateOgmPersistence</tt> as the provider class enables Hibernate OGM (instead of Hibernate ORM), which is configured with some properties for the setting backend (INFINISPAN in this case), database name etc.
</p>
<p class="wikiPara">
Note that it actually should not be required to specify the entity types in persistence.xml when running in a Java EE container such as WildFly. Instead they should be picked up automatically. When using Hibernate OGM this unfortunately is needed at the moment. This a known limitation (see <a href="https://hibernate.atlassian.net/browse/OGM-828" target="" class="regularLink">OGM-828</a>) which we hope to fix soon.
</p>
<p class="wikiPara">
The next step is to implement repository classes for accessing hike and organizer data. As an example, the following shows the <tt>PersonRepository</tt> class:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@ApplicationScoped
public class PersonRepository {
@PersistenceContext
private EntityManager entityManager;
public Person create(Person person) {
entityManager.persist( person );
return person;
}
public Person get(String id) {
return entityManager.find( Person.class, id );
}
public List&lt;Person&gt; getAll() {
return entityManager.createQuery( "FROM Person p", Person.class ).getResultList();
}
public Person save(Person person) {
return entityManager.merge( person );
}
public void remove(Person person) {
entityManager.remove( person );
for ( Hike hike : person.getOrganizedHikes() ) {
hike.setOrganizer( null );
}
}
}</pre>
<p class="wikiPara">
The implementation is straight-forward; by means of the <tt>@ApplicationScoped</tt> annotation, the class is marked as application-scoped CDI bean (i.e. one single instance of this bean exists throughout the lifecycle of the application). It obtains a JPA entity manager through dependency injection and uses the same to implement some simple CRUD methods (Create, Read, Update, Delete).
</p>
<p class="wikiPara">
Note how the <tt>getAll()</tt> method uses a JP-QL query to return all person objects. Upon execution this query will be transformed into an equivalent Lucene index query which will be run through Hibernate Search.
</p>
<p class="wikiPara">
The hike repository looks very similar, so it’s omitted here for the sake of brevity. You can find <a href="https://github.com/hibernate/hibernate-demos/blob/master/hibernate-ogm/hiking-demo/src/main/java/org/hibernate/ogm/hiking/repository/HikeRepository.java" target="" class="regularLink">its source code</a> on GitHub.
</p>
<h3 class="wikiHeadline3" id="H-ExposingRESTServices"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-ExposingRESTServices">Exposing REST services</a></h3>
<p class="wikiPara">
JAX-RS makes building REST-ful web services a breeze. It defines a declarative programming model where you annotate plain old Java classes to provide implementations for the GET, POST, PUT etc. operations of an HTTP endpoint.
</p>
<p class="wikiPara">
Describing JAX-RS in depth is beyond the scope of this tutorial, e.g. refer to the <a href="https://docs.oracle.com/javaee/7/tutorial/jaxrs.htm#GIEPU" target="" class="regularLink">Java EE 7 tutorial</a> if you would like to learn more. Let’s just have a look at the some methods of a resource class for managing persons as an example:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Path("/persons")
@Produces("application/json")
@Consumes("application/json")
@Stateless
public class Persons {
@Inject
private PersonRepository personRepository;
@Inject
private ResourceMapper mapper;
@Inject
private UriMapper uris;
@POST
@Path("/")
public Response createPerson(PersonDocument request) {
Person person = personRepository.create( mapper.toPerson( request ) );
return Response.created( uris.toUri( person ) ).build();
}
@GET
@Path("/{id}")
public Response getPerson(@PathParam("id") String id) {
Person person = personRepository.get( id );
if ( person == null ) {
return Response.status( Status.NOT_FOUND ).build();
}
else {
return Response.ok( mapper.toPersonDocument( person ) ).build();
}
}
@GET
@Path("/")
public Response listPersons() { … }
@PUT
@Path("/{id}")
public Response updatePerson(PersonDocument request, @PathParam("id") String id) { … }
@DELETE
@Path("/{id}")
public Response deletePerson(@PathParam("id") String id) { … }
}</pre>
<p class="wikiPara">
The <tt>@Path</tt>, <tt>@Produces</tt> and <tt>@Consumes</tt> annotations are defined by JAX-RS. They bind the resource methods to specific URLs, expecting and creating JSON based messages. <tt>@GET</tt>, <tt>@POST</tt>, <tt>@PUT</tt> and <tt>@DELETE</tt> configure for which HTTP verb each method is responsible.
</p>
<p class="wikiPara">
The <tt>@Stateless</tt> annotation defines this POJO as a stateless session bean. Dependencies such as the <tt>PersonRepository</tt> can be obtained via <tt>@Inject</tt>-based dependency injection. Implementing a session bean gives you the comfort of transparent transaction management by the container. Invocations of the methods of <tt>Persons</tt> will automatically be wrapped in a transaction, and all the interactions of Hibernate OGM with the datastore will participate in the same. This means that any changes you do to managed entities - e.g. by persisting a new person via <tt>PersonRepository#create()</tt> or by modifying a <tt>Person</tt> object retrieved from the entity manager - will be committed to the datastore after the method call returns.
</p>
<h3 class="wikiHeadline3" id="H-MappingModels"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-MappingModels">Mapping models</a></h3>
<p class="wikiPara">
Note that the methods of our REST service do not return and accept the managed entity types themselves, but rather specific transport structures such as <tt>PersonDocument</tt>:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">public class PersonDocument {
private String firstName;
private String lastName;
private Set&lt;URI&gt; organizedHikes;
// constructors, getters and setters...
}</pre>
<p class="wikiPara">
The reasoning for that is to represent the elements of associations (<tt>Person#organizedHikes</tt>, <tt>Hike#organizer</tt>) in form of URIs, which enables a client to fetch these linked resources as required. E.g. a GET call to <i class="wikiEmphasis">http://myserver/ogm-demo-part3/hike-manager/persons/123</i> may return a JSON structure like the following:
</p>
<pre class="wikiPreformatted">
{
"firstName": "Saundra",
"lastName": "Johnson",
"organizedHikes": [
"http://myserver/ogm-demo-part3/hike-manager/hikes/456",
"http://myserver/ogm-demo-part3/hike-manager/hikes/789"
]
}</pre>
<p class="wikiPara">
The mapping between the internal model (e.g. entity <tt>Person</tt>) and the external one (e.g. <tt>PersonDocument</tt>) can quickly become a tedious and boring task, so some tool-based support for this is desirable. Several tools exist for this job, most of which use reflection or runtime byte code generation for propagating state between different models.
</p>
<p class="wikiPara">
Another approach for this is pursued by <a href="http://mapstruct.org/" target="" class="regularLink">MapStruct</a>, which is a spare time project of mine and generates bean mapper implementations at compile time (e.g. with Maven or in your IDE) via a Java annotation processor. The code it generates is type-safe, fast (it's using plain method calls, no reflection) and dependency-free. You just need to declare Java interfaces with mapping methods for the source and target types you need and MapStruct will generate an implementation as part of the compilation process:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Mapper(
// allows to obtain the mapper via @Inject
componentModel = "cdi",
// a hand-written mapper class for converting entities to URIs; invoked by the generated
// toPersonDocument() implementation for mapping the organizedHikes property
uses = UriMapper.class
)
public interface ResourceMapper {
PersonDocument toPersonDocument(Person person);
List&lt;PersonDocument&gt; toPersonDocuments(Iterable&lt;Person&gt; persons);
@Mapping(target = "date", dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
HikeDocument toHikeDocument(Hike hike);
// other mapping methods ...
}</pre>
<p class="wikiPara">
The generated implementation can then be used in the <tt>Persons</tt> REST resource to map from the internal to the external model and vice versa. If you would like to learn more about this approach for model mappings, check out the <a href="https://github.com/hibernate/hibernate-demos/blob/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-3/src/main/java/org/hibernate/ogm/demos/ogm101/part3/rest/mapper/ResourceMapper.java" target="" class="regularLink">complete mapper interface</a> on GitHub or the <a href="http://mapstruct.org/documentation" target="" class="regularLink">MapStruct reference documentation</a>.
</p>
<h3 class="wikiHeadline3" id="H-Wrapup"><a href="http://in.relation.to/2015/06/03/no-sql-with-hibernate-ogm-building-arest-application-on-wild-fly#H-Wrapup">Wrap-up</a></h3>
<p class="wikiPara">
In this part of our tutorial series you learned how to add Hibernate OGM to the WildFly application server and use it to access Infinispan as the data storage for a small REST application.
</p>
<p class="wikiPara">
WildFly is a great runtime environment for applications using Hibernate OGM, as it provides most of the required building blocks out of the box (e.g. JPA/Hibernate ORM, JTA, transaction management etc.), tightly integrated and ready to use. Our module ZIP allows to put the Hibernate OGM modules into the mix very easily, without the need for re-deploying them each time with your application. With <a href="http://wildfly.org/news/2015/05/05/WildFly-Swarm-Released/" target="" class="regularLink">WildFly Swarm</a> there is also support for the micro-services architectural style, but we’ll leave it for another time to show how to use Hibernate OGM with Wildfly Swarm (currently JPA support is still lacking from WildFly Swarm).
</p>
<p class="wikiPara">
You can find the sources of the project <a href="https://github.com/hibernate/hibernate-demos/tree/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-3" target="" class="regularLink">on GitHub</a>. To build the project run <tt>mvn clean install</tt> (which executes an <a href="https://github.com/hibernate/hibernate-demos/blob/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-3/src/test/java/org/hibernate/ogm/demos/ogm101/part3/rest/PersonsIT.java" target="" class="regularLink">integration test</a> for the REST services using Arquillian, an exciting topic on its own). Alternatively, the Maven WildFly plug-in can be used to fire up a WildFly instance and deploy the application via <tt>mvn wildfly:run</tt>, which is great for manual testing e.g. by sending HTTP requests through curl or wget.
</p>
<p class="wikiPara">
If you have any questions, let us know in the comments below or send us a Tweet to <a href="https://twitter.com/Hibernate" target="" class="regularLink">@Hibernate</a>. Also your wishes for future parts of this tutorial are welcome. Stay tuned!
</p>
</div>
http://in.relation.to/2015/06/02/the-new-faceting-engine-gets-closer-hibernate-search-530-cr-1-released/The new Faceting engine gets closer: Hibernate Search 5.3.0.CR1 released!2015-06-02T00:00:00Z2015-06-02T00:00:00ZSanne Grinovero
Tonight we released Hibernate Search version 5.3.0.CR1 (candidate release).
We consider this stable, and besides some pending documentation improvements, we'll re-publish the same implementation as 5.3.0.Final in ten days. Last chance to provide feedback! Please try it out.
Brand-new but proven faceting technology
The technology which Hibernate Search uses under the hood to implement this amazing feature has been improved and polished in various years by the Apache Lucene team. So far Hibernate Search has been using an old and proven technique but this had several limitations.
We believe the new implementation is now mature enough for our users too, and probably should have...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Tonight we released Hibernate Search version <i class="wikiEmphasis">5.3.0.CR1</i> (candidate release).
</p>
<p class="wikiPara">
We consider this stable, and besides some pending documentation improvements, we'll re-publish the same implementation as 5.3.0.Final in ten days. Last chance to provide feedback! Please try it out.
</p>
<h3 class="wikiHeadline2" id="H-BrandnewButProvenFacetingTechnology"><a href="http://in.relation.to/2015/06/02/the-new-faceting-engine-gets-closer-hibernate-search-530-cr-1-released#H-BrandnewButProvenFacetingTechnology">Brand-new but proven faceting technology</a></h3>
<p class="wikiPara">
The technology which Hibernate Search uses under the hood to implement this amazing feature has been improved and polished in various years by the Apache Lucene team. So far Hibernate Search has been using an <q>old and proven</q> technique but this had several limitations.
</p>
<p class="wikiPara">
We believe the new implementation is now mature enough for our users too, and probably should have switched earlier if we didn't have other subjects to attack.
</p>
<p class="wikiPara">
From a user's perspective, there are less limitations and the API is the same, <i class="wikiEmphasis">with one migration catch</i>: please remember you now need to opt-in the fields you want to use for faceting explicitly! For that, use the <tt>@Facet</tt> annotation as shown in <a href="http://in.relation.to/2015/05/11/hibernate-search-530-beta-1-with-native-lucene-faceting" target="" class="regularLink">the example of the previous post</a> and in the <a href="http://docs.jboss.org/hibernate/search/5.3/reference/en-US/html_single/#query-faceting" target="" class="regularLink">Faceting reference documentation</a>.
</p>
<h3 class="wikiHeadline2" id="H-WhatsNext"><a href="http://in.relation.to/2015/06/02/the-new-faceting-engine-gets-closer-hibernate-search-530-cr-1-released#H-WhatsNext">What's next?</a></h3>
<p class="wikiPara">
Our immediate focus is to release am experimental tag to support Hibernate ORM 5: remember, Hibernate Search versions from 4.5 up to (and including) 5.3 are only compatible with Hibernate ORM versions 4.3.x.
</p>
<p class="wikiPara">
Of course, we're also looking forward for feedback and will try and schedule any issues you encounter on the latest versions to be fixed ASAP. Suggestions and contributions are welcome as well!
</p>
<h3 class="wikiHeadline3" id="H-Links"><a href="http://in.relation.to/2015/06/02/the-new-faceting-engine-gets-closer-hibernate-search-530-cr-1-released#H-Links">Links</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Artefact jars are available on Maven Central under the GAV <u>org.hibernate:hibernate-search-orm:5.3.0.CR1</u>
</li>
<li class="wikiUnorderedListItem"> Zip and tar bundles are available via <a href="http://hibernate.org/search/downloads/" target="" class="regularLink">our website</a>
</li>
<li class="wikiUnorderedListItem"> Feedback is welcome on the <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a> and <a href="http://hibernate.org/community/" target="" class="regularLink">emails, IRC</a>
</li>
</ul>
</div>
http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out/Hibernate OGM 4.2 Final is out2015-06-02T00:00:00Z2015-06-02T00:00:00ZDavide D'Alto
After several months of hard work, I'm happy to announce the next final release of Hibernate OGM: 4.2.
What's new?
Compared to 4.1 Final, this version includes:
API for retrieving all executed and failed datastore operations,
preview for Apache Cassandra support,
Fongo support,
new built-in types for boolean mapping,
Support for MongoDB 3 and MongoDB replica sets
HQL support improvements and bug fixes,
bug fixes related to the mapping of embedded properties,
at least JDK 7 is required, more details in the migration notes
You can find more details for each one of them in our previous posts about release 4.2 Beta1
and 4.2...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
After several months of hard work, I'm happy to announce the next final release of Hibernate OGM: 4.2.
</p>
<h3 class="wikiHeadline3" id="H-WhatsNew"><a href="http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out#H-WhatsNew">What's new?</a></h3>
<p class="wikiPara">
Compared to <a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final" target="" class="regularLink">4.1 Final</a>, this version includes:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="http://in.relation.to/2015/03/17/hibernate-ogm-error-handling-on-nontransactional-no-sql-stores" target="" class="regularLink">API for retrieving all executed and failed datastore operations</a>,</li>
<li class="wikiUnorderedListItem"> preview for <a href="http://cassandra.apache.org" target="" class="regularLink">Apache Cassandra</a> support,</li>
<li class="wikiUnorderedListItem"> <a href="https://github.com/fakemongo/fongo" target="" class="regularLink">Fongo</a> support,</li>
<li class="wikiUnorderedListItem"> new built-in types for boolean mapping,</li>
<li class="wikiUnorderedListItem"> <a href="http://docs.mongodb.org/manual/replication/" target="" class="regularLink">Support for MongoDB 3 and MongoDB replica sets</a>
</li>
<li class="wikiUnorderedListItem"> HQL support improvements and bug fixes,</li>
<li class="wikiUnorderedListItem"> bug fixes related to the mapping of embedded properties,</li>
<li class="wikiUnorderedListItem"> at least JDK 7 is required, more details <a href="https://developer.jboss.org/wiki/HibernateOGMMigrationNotes" target="" class="regularLink">in the migration notes</a>
</li>
</ul>
<p class="wikiPara">
You can find more details for each one of them in our previous posts about release <a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released" target="" class="regularLink">4.2 Beta1</a>
and <a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out" target="" class="regularLink">4.2 CR1</a>.
</p>
<p class="wikiPara">
A list of all resolved issues is available in the <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10160&amp;version=16953" target="" class="regularLink">release notes</a> (you can also find the one for <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10160&amp;version=16953" target="" class="regularLink">4.2.CR1 </a> and the one for <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10160&amp;version=19050" target="" class="regularLink">4.2.Beta1</a>).
</p>
<h3 class="wikiHeadline3" id="H-HowCanIGetIt"><a href="http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out#H-HowCanIGetIt">How can I get it?</a></h3>
<p class="wikiPara">
You can download Hibernate OGM 4.2.0.Final from <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.2.0.Final/" target="" class="regularLink">SourceForge</a> or via Maven, Gradle etc., using the following GAV coordinates:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.2.0.Final</i> for the Hibernate OGM engine and</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.2.0.Final</i>, depending on the backend you want to use.</li>
</ul>
<h3 class="wikiHeadline3" id="H-ImNewToHibernateOGMWhereShouldIStart"><a href="http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out#H-ImNewToHibernateOGMWhereShouldIStart">I’m new to Hibernate OGM, where should I start?</a></h3>
<p class="wikiPara">
If you are not familiar with Hibernate OGM, most of what you need is available in <a href="http://ogm.hibernate.org" target="" class="regularLink">our web site</a>.
There is a <a href="http://hibernate.org/ogm/documentation/getting-started/" target="" class="regularLink">getting started guide</a> and the more complete <a href="http://docs.jboss.org/hibernate/ogm/4.2/reference/en-US/html_single/" target="" class="regularLink">reference documentation</a>.
And last but not least, for any help or feedback, reach us via our <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">forum</a> or via <a href="http://hibernate.org/community/" target="" class="regularLink">IRC</a>.
</p>
<h3 class="wikiHeadline3" id="H-WhatsNext"><a href="http://in.relation.to/2015/06/02/hibernate-ogm-42-final-is-out#H-WhatsNext">What’s next?</a></h3>
<p class="wikiPara">
We have <a href="http://hibernate.org/ogm/roadmap/" target="" class="regularLink">plenty of ideas</a>:
migrate to Hibernate ORM 5, custom types, new datastores, denormalization engine, and more.
You can influence what we are going to include in the next release letting us hear your voice with feedback, questions or ideas.
</p>
<p class="wikiPara">
Many thanks to all the people that helped us make this release possible.
</p>
</div>
http://in.relation.to/2015/05/28/hibernate-orm-500-cr-1-release/Hibernate ORM 5.0.0.CR1 Release2015-05-28T00:00:00Z2015-05-28T00:00:00ZSteve Ebersole
The Hibernate team is proud to announce the first candidate release for 5.0. The main changes since the Beta2 release include:
Initial generic typing for Hibernate native (Session, e.g.) APIs
Continued development of the new bytecode enhancement capabilities including improved support in the Maven and Gradle plugins
Support for parameterized types with AttributeConverter implementations
Improved OSGi integration testing using Pax Exam and Karaf, and publishing a hibernate-osgi Karaf features file
Auto quoting of keywords used as identifiers (User, e.g.).
Incorporating fixes, improvements and suggestions to the improved schema update and validation tooling
A lot of help from the community went...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
The Hibernate team is proud to announce the first candidate release for 5.0. The main changes since the Beta2 release include:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Initial generic typing for Hibernate native (Session, e.g.) APIs</li>
<li class="wikiUnorderedListItem"> Continued development of the new bytecode enhancement capabilities including improved support in the Maven and Gradle plugins</li>
<li class="wikiUnorderedListItem"> Support for parameterized types with AttributeConverter implementations</li>
<li class="wikiUnorderedListItem"> Improved OSGi integration testing using Pax Exam and Karaf, and publishing a hibernate-osgi Karaf features file</li>
<li class="wikiUnorderedListItem"> Auto quoting of keywords used as identifiers (<q>User</q>, e.g.).</li>
<li class="wikiUnorderedListItem"> Incorporating fixes, improvements and suggestions to the improved schema update and validation tooling</li>
</ul>
<p class="wikiPara">
A lot of help from the community went into this release and the previous Beta releases. Thanks for all the help and work and testing and doggedness!
</p>
<p class="wikiPara">
As always, see <a href="http://hibernate.org/orm/downloads/" target="" class="regularLink">http://hibernate.org/orm/downloads/</a> for information on obtaining the releases.
</p>
<p class="wikiPara">
Report any issues to <a href="https://hibernate.atlassian.net/browse/HHH" target="" class="regularLink">Hibernate Jira</a></p>
</div>
http://in.relation.to/2015/05/26/first-52-candidate-release-hibernate-validator-520-cr-1/First 5.2 Candidate Release - Hibernate Validator 5.2.0.CR12015-05-26T00:00:00Z2015-05-26T00:00:00ZHardy Ferentschik
Moving along towards a 5.2 Final, we are happy to announce
the release of Hibernate Validator 5.2.0.CR1. The main goal of this release was to fix
bugs and polish some of the new features. For example, we reviewed the
Optional validation support and made sure its behavior is (what we think)
consistent in all cases. You can find the full change log on
JIRA.
Despite the focus on bug fixes, we still managed to sneak in a couple of new features.
Hibernate Validator offers now a TimeProvider contract, as well
as an extension of the
Path API which allows to obtain the value of the represented property. Refer to...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Moving along towards a 5.2 Final, we are happy to announce
the release of Hibernate Validator 5.2.0.CR1. The main goal of this release was to fix
bugs and polish some of the new features. For example, we reviewed the
<tt>Optional</tt> validation support and made sure its behavior is (what we think)
consistent in all cases. You can find the full change log on
<a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10060&amp;version=19254" target="" class="regularLink">JIRA</a>.
</p>
<p class="wikiPara">
Despite the focus on bug fixes, we still managed to sneak in a couple of new features.
Hibernate Validator offers now a <a href="http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html_single/#section-time-provider" target="" class="regularLink">TimeProvider</a> contract, as well
as an <a href="http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html_single/#section-extensions-path-api" target="" class="regularLink">extension</a> of the
<a href="http://docs.jboss.org/hibernate/beanvalidation/spec/1.1/api/javax/validation/Path.html" target="" class="regularLink">Path API</a> which allows to obtain the value of the represented property. Refer to the online documentation for more information.
</p>
<p class="wikiPara">
Another more general question, which created quite a bit of discussion, revolved around
the validation of Java 8 date/time types (JSR 310) (see
<a href="https://hibernate.atlassian.net/browse/HV-874" target="" class="regularLink">HV-874</a>). The question is, whether
we can/should provide default <tt>ConstraintValidator</tt> implementations for
<tt>@Past</tt> and <tt>@Future</tt> validating <tt>LocalDate</tt> (or any of the other date/time types which
do not represent a instant in time). The Javadocs tells us:
</p>
<blockquote class="wikiBlockquote">
This class does not store or represent a time or time-zone. Instead, it is a description
of the date, as used for birthdays. It cannot represent an instant on the time-line without
additional information such as an offset or time-zone.
</blockquote>
<p class="wikiPara">
Without a instant in time, however, past and future are undefined. One can only validate
such an instant by associating a timezone with it. But which one? The time zone of the
current JVM? That could lead to unexpected behavior for example in client-server
applications. If you have an opinion on this or an idea on how to solve this, please leave a
comment or use any of the other means listed below to get into touch with us.
We would love to hear from you.
For now, Hibernate Validator will not support <tt>LocalDate</tt> out of the box. We will see how
this pans out.
</p>
<h3 class="wikiHeadline2" id="H-WhereDoIGetTheRelease"><a href="http://in.relation.to/2015/05/26/first-52-candidate-release-hibernate-validator-520-cr-1#H-WhereDoIGetTheRelease">Where do I get the release?</a></h3>
<p class="wikiPara">
Maven artifacts can be found in the JBoss Maven repository
(GAV <a href="https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.hibernate~hibernate-validator~5.2.0.CR1~" target="" class="regularLink">org.hibernate:hibernate-validator:5.2.0.CR1</a>) and will
within a short time also be synced to <a href="http://search.maven.org/" target="" class="regularLink">Maven Central</a>.
Distribution bundles are as usual available on <a href="https://sourceforge.net/projects/hibernate/files/hibernate-validator/5.2.0.CR1" target="" class="regularLink">SourceForge</a>.
</p>
<p class="wikiPara">
Feedback and questions are welcome via the Hibernate Validator
<a href="https://forum.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forum</a> or on stackoverflow using the
<a href="http://stackoverflow.com/questions/tagged/hibernate-validator" target="" class="regularLink">hibernate-validator</a> tag.
</p>
<p class="wikiPara">
Enjoy!</p>
</div>
http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out/Cassandra support, query improvements, more built-in types: Hibernate OGM 4.2.0.CR1 is out2015-05-20T00:00:00Z2015-05-20T00:00:00ZGunnar Morling
I am pleased to announce the release of Hibernate OGM 4.2.0.CR1.
The new version comes to you with initial support for Apache Cassandra, several improvements around JP-QL queries, support for MongoDB 3, MongoDB replica sets, new built-in types and much more.
You can download Hibernate OGM 4.2.0.CR1 from SourceForge or via Maven, Gradle etc., using the following GAV coordinates:
org.hibernate.ogm:hibernate-ogm-core:4.2.0.CR1 for the Hibernate OGM engine and
org.hibernate.ogm:hibernate-ogm-<%DATASTORE%>:4.2.0.CR1, depending on the backend you want to use.
Preview for Apache Cassandra support
Cassandra is a highly performant and scalable datastore of the BigTable family. The request for supporting it dates back to the early days of...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
I am pleased to announce the release of Hibernate OGM 4.2.0.CR1.
</p>
<p class="wikiPara">
The new version comes to you with initial support for Apache Cassandra, several improvements around JP-QL queries, support for MongoDB 3, MongoDB replica sets, new built-in types and much more.
</p>
<p class="wikiPara">
You can download Hibernate OGM 4.2.0.CR1 from <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.2.0.CR1/" target="" class="regularLink">SourceForge</a> or via Maven, Gradle etc., using the following GAV coordinates:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.2.0.CR1</i> for the Hibernate OGM engine and</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.2.0.CR1</i>, depending on the backend you want to use.</li>
</ul>
<h3 class="wikiHeadline3" id="H-PreviewForApacheCassandraSupport"><a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out#H-PreviewForApacheCassandraSupport">Preview for Apache Cassandra support</a></h3>
<p class="wikiPara">
<a href="http://cassandra.apache.org/" target="" class="regularLink">Cassandra</a> is a highly performant and scalable datastore of the <a href="http://en.wikipedia.org/wiki/BigTable" target="" class="regularLink">BigTable family</a>. The request for supporting it dates back to the early days of Hibernate OGM. So it’s a great pleasure to finally have this puppy out. Many thanks to all that worked on this journey: Michaël Figuière, Khanh Maudoux, John Worrell and Jonathan Halliday!
</p>
<p class="wikiPara">
To use the Cassandra backend, add the hibernate-ogm-cassandra module to your classpath and specify the following properties for your persistence unit:
</p>
<pre class="wikiPreformatted">
hibernate.ogm.datastore.provider = cassandra_experimental
hibernate.ogm.datastore.database = my_keyspace
hibernate.ogm.datastore.host = cassandra.example.com</pre>
<p class="wikiPara">
The Cassandra backend is in “tech preview” state at this moment. We still have lots of work left on our plates (e.g. clustering support, alternative association persistence options, queries, documentation), but we think we have the right foundation now. Be warned that mapping details still may change. Still this is the right time for you to give this new backend a first try and let us know about your experiences with it.
</p>
<p class="wikiPara">
Any feature requests, error reports and other feedback are very welcome. Especially any thoughts on the proposed mapping of domain model elements to Cassandra structures are of great interest for us.
</p>
<h3 class="wikiHeadline3" id="H-QueryImprovements"><a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out#H-QueryImprovements">Query improvements</a></h3>
<p class="wikiPara">
We spent some more time to improve support for mapping JP-QL queries either to native NoSQL queries or full-text queries executed via Hibernate Search + Lucene.
</p>
<p class="wikiPara">
You can now use types like enums or <tt>Date</tt> as query parameters:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">List&lt;Movie&gt; movies = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.genre IN (:genre)", Movie.class )
.setParameter( "genre", EnumSet.of( Genre.DRAMA, Genre.COMEDY ) )
.getResultList();</pre>
<p class="wikiPara">
As you would expect it, the given parameter values are converted into the corresponding type used in the datastore and passed to the query engine.
</p>
<h3 class="wikiHeadline3" id="H-MappingFixForElementCollectionsWithNestedEmbeddables"><a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out#H-MappingFixForElementCollectionsWithNestedEmbeddables">Mapping fix for element collections with nested embeddables</a></h3>
<p class="wikiPara">
This release fixes a bug related to the mapping of nested embeddables stored within element collections. This affects the supported document stores as well as Neo4j. E.g. consider the following entity model:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
public class Account {
@ElementCollection
List&lt;Address&gt; addresses;
}
@Embeddable
public class Address {
String street;
String city;
AddressType type;
}
@Embeddable
public class AddressType {
String name;
}</pre>
<p class="wikiPara">
Previously, this would have been stored as follows e.g. in MongoDB:
</p>
<pre class="wikiPreformatted">
{
"_id" : "account-1",
"addresses" : [
{
"street" : "Piazza del Colosseo, 1",
"city" : "Rome",
"name" : "work" &lt;-- “flattened” representation of the nested embeddable
},
...
]
}</pre>
<p class="wikiPara">
Whereas it really should be mapped like this:
</p>
<pre class="wikiPreformatted">
{
"_id" : "account-1",
"addresses" : [
{
"street" : "Piazza del Colosseo, 1",
"city" : "Rome",
“type” : {
"name" : "work"
}
},
...
]
}</pre>
<p class="wikiPara">
This is the mapping applied as of this new release. Note that you need to take care of existing records should have been working with such a model. Also please check out the <a href="https://developer.jboss.org/wiki/HibernateOGMMigrationNotes" target="" class="regularLink">migration notes</a> for the details.
</p>
<p class="wikiPara">
We don’t take such mapping changes lightly and try to avoid them as much as we can. As this really was a mapping error, we decided to fix it as soon as possible; in the future we also may provide compatibility options or some sort of migration tooling in similar situations.
</p>
<h3 class="wikiHeadline3" id="H-SupportForMongoDB3AndMongoDBReplicaSets"><a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out#H-SupportForMongoDB3AndMongoDBReplicaSets">Support for MongoDB 3 and MongoDB replica sets</a></h3>
<p class="wikiPara">
We now also support MongoDB 3. In particular the new SCRAM-SHA-1 authentication strategy is working now. Migration should be smooth.
</p>
<p class="wikiPara">
But the biggest improvement is support for replica sets. To quote <a href="http://docs.mongodb.org/manual/replication/" target="" class="regularLink">MongoDB’s documentation</a>, a replica set “is a group of mongod processes that maintain the same data set”. By using replica sets, your data is stored redundantly and protected against node failures through automatic fail-over between replica set members.
</p>
<p class="wikiPara">
To support the notion of replica sets, Hibernate OGM’s “host” configuration option has been enhanced and now allows to specify a comma-separated list of hosts and host:port tuples:
</p>
<pre class="wikiPreformatted">
hibernate.ogm.datastore.host=db1.example.com,db2.example.com,db3.example.com:29019</pre>
<p class="wikiPara">
With this configuration Hibernate OGM would connect to three MongoDB nodes, using the default port 27017 for the nodes db1 and db2 and the explicitly given port 29019 for node db3.
</p>
<p class="wikiPara">
Currently the MongoDB backend is the only one supporting several nodes, but other backends will follow, e.g. Cassandra.
</p>
<h3 class="wikiHeadline3" id="H-NewBuiltinTypesForBooleanMapping"><a href="http://in.relation.to/2015/05/20/cassandra-support-query-improvements-more-builtin-types-hibernate-ogm-420-cr-1-is-out#H-NewBuiltinTypesForBooleanMapping">New built-in types for boolean mapping</a></h3>
<p class="wikiPara">
Requested by a user in our forum, we now support all the boolean mapping types known from Hibernate ORM: <tt>YesNoType</tt> (maps to character/String “Y” or “N”), <tt>TrueFalseType</tt> (maps to “T” or “F”) and <tt>NumericBooleanType</tt> (maps to 1 or 0).
</p>
<p class="wikiPara">
You can use these types by means of the <tt>@Type</tt> annotation like so:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">// maps as boolean; default
private boolean myBoolean;
@Type(type = "true_false")
private boolean myBoolean;
@Type(type = "yes_no")
private boolean myBoolean;
@Type(type = "numeric_boolean")
private boolean myBoolean;</pre>
<p class="wikiPara">
Any feedback to the 4.2.0.CR1 release is highly welcome. The <a href="https://github.com/hibernate/hibernate-ogm/blob/4.2.0.CR1/changelog.txt" target="" class="regularLink">change log</a> tells in detail what's in there for you. Finally, some more useful links:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">User forum</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/browse/OGM" target="" class="regularLink">Issue tracker</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://lists.jboss.org/pipermail/hibernate-dev/" target="" class="regularLink">Mailing list</a>
</li>
</ul>
</div>
http://in.relation.to/2015/05/15/hibernate-orm-4310-final-released/Hibernate ORM 4.3.10.Final Released2015-05-15T00:00:00Z2015-05-15T00:00:00ZGail Badner
The primary reason for this release is to add support for running Hibernate ORM with Infinispan 7.2.1.Final as a runtime dependency. Hibernate still uses Infinispan 6.0.0.Final by default.
The plan is for WildFly 9 to include Hibernate ORM 4.3.10.Final. Since WildFly 9 uses Infinispan 7.2.1.Final, we had to make some corrections so that Hibernate ORM works properly with Infinispan 7.2.1.Final (as well as 6.0.0.Final) as a cache provider. To avoid backward-compatibility issues, Hibernate still uses an Infinispan 6.0.0.Final configuration by default.
In order to use Hibernate ORM with Infinispan 7.2.1.Final, it is necessary to specify an Infinispan 7.2 configuration using the...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
The primary reason for this release is to add support for running Hibernate ORM with Infinispan 7.2.1.Final as a runtime dependency. Hibernate still uses Infinispan 6.0.0.Final by default.
</p>
<p class="wikiPara">
The plan is for WildFly 9 to include Hibernate ORM 4.3.10.Final. Since WildFly 9 uses Infinispan 7.2.1.Final, we had to make some corrections so that Hibernate ORM works properly with Infinispan 7.2.1.Final (as well as 6.0.0.Final) as a cache provider. To avoid backward-compatibility issues, Hibernate still uses an Infinispan 6.0.0.Final configuration by default.
</p>
<p class="wikiPara">
In order to use Hibernate ORM with Infinispan 7.2.1.Final, it is necessary to specify an Infinispan 7.2 configuration using the environment variable, hibernate.cache.infinispan.cfg. An example of an Infinispan 7.2 configuration has been added as a test resource <a href="https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-infinispan/src/test/resources/infinispan-7-configs.xml" target="" class="regularLink">here</a>.
</p>
<p class="wikiPara">
For more information about changes to support Infinispan 7.2.1.Final, see: <a href="https://hibernate.atlassian.net/browse/HHH-9776" target="" class="regularLink">HHH-9776</a> and <a href="https://hibernate.atlassian.net/browse/HHH-9781" target="" class="regularLink">HHH-9781</a>.
</p>
<p class="wikiPara">
Other changes were minor. For more information, please see: <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=19650" target="" class="regularLink">https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=19650</a>
</p>
<p class="wikiPara">
JBoss Nexus: <a href="https://repository.jboss.org/nexus/content/groups/public/org/hibernate" target="" class="regularLink">https://repository.jboss.org/nexus/content/groups/public/org/hibernate</a><br>
Maven Central: <a href="http://repo1.maven.org/maven2/org/hibernate/hibernate-core" target="" class="regularLink">http://repo1.maven.org/maven2/org/hibernate/hibernate-core</a> (should update in a couple of days)<br>
</p>
<p class="wikiPara">
SourceForge: <a href="https://sourceforge.net/projects/hibernate/files/hibernate4" target="" class="regularLink">https://sourceforge.net/projects/hibernate/files/hibernate4</a><br>
4.3.10.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.10.Final/hibernate-release-4.3.10.Final.zip/download" target="" class="regularLink">4.3.10.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.10.Final/hibernate-release-4.3.10.Final.tgz/download" target="" class="regularLink">4.3.10.Final TGZ</a><br></p>
</div>
http://in.relation.to/2015/05/11/hibernate-search-530-beta-1-with-native-lucene-faceting/Hibernate Search 5.3.0.Beta1 with native Lucene faceting2015-05-11T00:00:00Z2015-05-11T00:00:00ZHardy Ferentschik
Following on the heels of 5.2.0.Final, Hibernate Search 5.3.0.Beta1 is now out. This time the faceting engine got an overhaul.
This work was long overdue, because there were several shortcomings with the existing implementation. For example, there were limitations with *ToMany associations. Also, the implementation was based on a custom Lucene Collector making use of the FieldCache API. FieldCache will be removed in Lucene 5, so updating the faceting API was also a requirement for upgrading to Lucene 5 in the near future.
What has changed? Actually not much when it comes to the API Hibernate Search exposes. You still create your...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Following on the heels of 5.2.0.Final, Hibernate Search 5.3.0.Beta1 is now out. This time the faceting engine got an overhaul.
</p>
<p class="wikiPara">
This work was long overdue, because there were several shortcomings with the existing implementation. For example, there were limitations with <i class="wikiEmphasis">*ToMany</i> associations. Also, the implementation was based on a custom Lucene <tt>Collector</tt> making use of the <tt>FieldCache</tt> API. <tt>FieldCache</tt> will be removed in Lucene 5, so updating the faceting API was also a requirement for upgrading to Lucene 5 in the near future.
</p>
<p class="wikiPara">
What has changed? Actually not much when it comes to the API Hibernate Search exposes. You still create your <tt>FacetingRequest</tt> using <tt>QueryBuilder.facet()...</tt>. You then enable the facet search by passing it to the <tt>FacetManager</tt> from which you also then retrieve the list of <tt>Facet</tt> instances after the query was executed. All this is unchanged and documented in the <a href="http://docs.jboss.org/hibernate/search/5.3/reference/en-US/html_single/#query-faceting" target="" class="regularLink">online documentation</a>.
</p>
<p class="wikiPara">
A few things have changed though. Most notably, you will need to tell Hibernate Search now which properties are used for faceting. You do so by adding <tt>@Facet</tt> (resp. <tt>@Facets</tt>) to these properties. The reason for this is, that under the hood the implementation is now based on Lucene's <a href="http://blog.mikemccandless.com/2013/05/dynamic-faceting-with-lucene.html" target="" class="regularLink">dynamic faceting</a> capabilties. For this to work, we need to index the facet values using the appropriate <tt>DocValues</tt> type (<tt>SortedSetDocValuesFacetField</tt>, <tt>NumericDocValuesField</tt> or <tt>DoubleDocValuesField</tt>). Below we see the use of the <tt>@Facet(s)</tt> annotation: </p>
<pre class="wikiPreformatted brush:java"> @Indexed
public class Quux {
@DocumentId
private Integer id;
@Field(analyze = Analyze.NO),
@Facets({
@Facet,
@Facet(name = "string_facet_value", encoding = FacetEncodingType.STRING)
})
private double value;
}</pre>
Notice that in this example the <tt>value</tt> field is configured with two facet annotations. The reason is, that per default numbers will be stored using numeric <tt>DocValues</tt> types (<tt>NumericDocValuesField</tt> and <tt>DoubleDocValuesField</tt>), whereas all other types use string based <tt>SortedSetDocValuesFacetField</tt>. Numeric values can then only be used with a range facet whereas discrete facets require string values. In the case where you want to use discrete faceting on a numeric field (for example if the field only contains a fixed number of possible values) <tt>FacetEncodingType.STRING</tt> needs to be used.
<p class="wikiPara">
This is inline with the fact that Hibernate Search 5.x indexes numbers now per default numerically (see this <a href="http://in.relation.to/2014/12/09/hibernate-search-500-candidate-release-1-spotted-in-the-wild" target="" class="regularLink">blog</a>).
</p>
<p class="wikiPara">
A final caveat - there was a change in the default behaviour of <tt>includeZeroCounts</tt> as part of a facet request. The default was to include zero counts, but has changed now to not include it. Instead it must be explicitly specified (calculating zero counts for discrete facets comes with a performance penalty!):</p>
<pre class="wikiPreformatted brush:java"> FacetingRequest request = queryBuilder( Car.class ).facet()
.name( "quuxFacetRequest" )
.onField( "string_facet_value" )
.discrete()
.includeZeroCounts( true )
.createFacetingRequest();</pre>
<h3 class="wikiHeadline2" id="H-ReleaseInfoForHibernateSearch530Beta1"><a href="http://in.relation.to/2015/05/11/hibernate-search-530-beta-1-with-native-lucene-faceting#H-ReleaseInfoForHibernateSearch530Beta1">Release info for Hibernate Search 5.3.0.Beta1</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Full change log is available on <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10061&amp;version=19951" target="" class="regularLink">JIRA</a>
</li>
<li class="wikiUnorderedListItem"> Artefact jars are available on Maven Central under the GAV <u>org.hibernate:hibernate-search-orm:5.3.0.Beta1</u>
</li>
<li class="wikiUnorderedListItem"> Zip and tar bundles on <a href="http://sourceforge.net/projects/hibernate/files/hibernate-search/5.3.0.Beta1" target="" class="regularLink">SourceForge</a>
</li>
</ul>
<p class="wikiPara">
Happy faceting!</p>
</div>
http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support/Hibernate Search 5.2.0.Final brings full multi-tenancy support2015-05-06T00:00:00Z2015-05-06T00:00:00ZSanne Grinovero
The latest stable release of Hibernate Search, version 5.2.0.Final, is now available in Maven mirrors and as traditional downloads from Sourceforge.
Multi-tenancy integration
The most visible new feature is that it now transparently integrates with Hibernate ORM's support for multi-tenancy. The Hibernate Search documentation on multi-tenancy describes how using this near feature from Hibernate ORM will affect the content of your indexes and how it is transparently applied to any Query operation.
The good news is that, while you might want to read the documentation to better understand how it works exactly, the documentation is short as it's all pretty much automatic: full-text...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
The latest stable release of Hibernate Search, version 5.2.0.Final, is now available in Maven mirrors and as traditional downloads from <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.2.0.Final" target="" class="regularLink">Sourceforge</a>.
</p>
<h3 class="wikiHeadline1" id="H-MultitenancyIntegration"><a href="http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support#H-MultitenancyIntegration">Multi-tenancy integration</a></h3>
<p class="wikiPara">
The most visible new feature is that it now transparently integrates with <a href="http://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html/ch16.html" target="" class="regularLink">Hibernate ORM's support for multi-tenancy</a>. The <a href="http://docs.jboss.org/hibernate/search/5.2/reference/en-US/html_single/#_using_a_tenant_aware_literal_fulltextsession_literal" target="" class="regularLink">Hibernate Search documentation on multi-tenancy</a> describes how using this near feature from Hibernate ORM will affect the content of your indexes and how it is transparently applied to any Query operation.
</p>
<p class="wikiPara">
The good news is that, while you might want to read the documentation to better understand how it works exactly, the documentation is short as it's all pretty much automatic: full-text queries are automatically filtered on the tenant identifier, providing the same semantics as you would with any other kind of query.
</p>
<h3 class="wikiHeadline1" id="H-OtherImprovements"><a href="http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support#H-OtherImprovements">Other improvements</a></h3>
<p class="wikiPara">
This version incorporates many more improvements which we won't list in detail here. As usual you might find some benefits in the areas of performance and efficiency, improved javadocs, improved OSGi support. The <a href="http://docs.jboss.org/hibernate/search/5.2/reference/en-US/html_single/#search-query-querydsl" target="" class="regularLink">Query builder DSL</a> is improving thanks to the ever increasing great feedback. Keep it coming, we'll keep improving!
</p>
<h3 class="wikiHeadline2" id="H-AReminderOnTheRequirementsForThisVersion"><a href="http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support#H-AReminderOnTheRequirementsForThisVersion">A reminder on the requirements for this version</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Java 7 or later</li>
<li class="wikiUnorderedListItem"> Hibernate versions 4.3.x</li>
<li class="wikiUnorderedListItem"> Apache Lucene versions 4.10.x</li>
</ul>
<h3 class="wikiHeadline1" id="H-WhatsComingNext"><a href="http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support#H-WhatsComingNext">What's coming next?</a></h3>
<p class="wikiPara">
We've been working on a <i class="wikiEmphasis">fully renewed Faceting support</i>. Version 5.3.0.Beta1 will be available very soon as well, and include all of this work. Brace yourself though! While it will be API compatible, it will require some changes to your mapping: watch this space.
</p>
<h3 class="wikiHeadline1" id="H-GetTheUpdate"><a href="http://in.relation.to/2015/05/06/hibernate-search-520-final-brings-full-multitenancy-support#H-GetTheUpdate">Get the update!</a></h3>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.2.0.Final" target="" class="regularLink">full distribution from here</a>, or get it from Maven Central, and don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.</p>
</div>
http://in.relation.to/2015/04/30/hibernate-orm-500-beta-2-release/Hibernate ORM 5.0.0.Beta2 Release2015-04-30T00:00:00Z2015-04-30T00:00:00ZSteve Ebersole
I have just finished releasing Hibernate O/RM 5.0.0.Beta2. Beyond Beta1, this release adds:
Support for Spatial/GIS data through importing Hibernate Spatial.
Complete redesign of bulk id tables used to support update/delete queries against multi-table structures. The redesign helps better fit what different databases support.
Redesign of transaction management
Much improved (and still improving!) schema management tooling for export, validation and migration.
At this point, 5.0.0 is getting a lot of testing. So even though it is still in Beta I am feeling pretty confident of its quality. I opted for another Beta here instead of CR1 for...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
I have just finished releasing Hibernate O/RM 5.0.0.Beta2. Beyond Beta1, this release adds:
</p>
<ol class="wikiOrderedList">
<li class="wikiOrderedListItem"> Support for Spatial/GIS data through importing Hibernate Spatial.</li>
<li class="wikiOrderedListItem"> Complete redesign of <q>bulk id tables</q> used to support update/delete queries against multi-table structures. The redesign helps better fit what different databases support.</li>
<li class="wikiOrderedListItem"> Redesign of transaction management</li>
<li class="wikiOrderedListItem"> Much improved (and still improving!) schema management tooling for export, validation and migration.</li>
</ol>
<p class="wikiPara">
At this point, 5.0.0 is getting a lot of testing. So even though it is still in Beta I am feeling pretty confident of its quality. I opted for another Beta here instead of CR1 for a few reasons:
</p>
<ol class="wikiOrderedList">
<li class="wikiOrderedListItem"> Investigate whether we want to convert Hibernate's native APIs (Session, etc) to be typed. There is one especially tricky case that needs to be figured out. A major release like this would be the time to do that</li>
<li class="wikiOrderedListItem"> I have just introduced some pretty significant Transaction changes since Beta1. I felt it would be prudent to have one more Beta to allow people time to try out those changes and allow for additional changes based on feedback</li>
<li class="wikiOrderedListItem"> I would still like to complete deprecating the Settings contract. The last piece there is the discussion I started earlier on the dev list wrt its usage in SPI contracts (L2 cache, etc). This effects a few integrations.</li>
<li class="wikiOrderedListItem"> I am working on better Karaf support for hibernate-osgi. Specifically creating a Karaf features respository that users can simply pick up and use. That work is well under way, but ongoing.</li>
</ol>
<p class="wikiPara">
As always, see <a href="http://hibernate.org/orm/downloads/" target="" class="regularLink">http://hibernate.org/orm/downloads/</a> for information on obtaining Hibernate O/RM.
</p>
</div>
http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released/Multi-Tenancy for Hibernate Search users: 5.2.0.Beta1 released2015-04-17T00:00:00Z2015-04-17T00:00:00ZSanne Grinovero
Last night we released Hibernate Search 5.2.0.Beta1, and as many users requested we worked on Multi-Tenancy support.
Multi-tenancy
This feature was available since some time in Hibernate ORM, but while Hibernate Search would not prevent you to use it, it wouldn't apply the same strict isolation on full-text queries.
This is all implemented now, and is super easy to use.
How to use it
It's not different than any usage of Hibernate ORM's multi-tenancy. After you open a tenant-aware 'Session', changes will be tagged as belonging to a specific tenant automatically.
When performing a full-text query, you'll only get results from the current tenant.
When rebuilding the...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Last night we released Hibernate Search 5.2.0.Beta1, and as many users requested we worked on Multi-Tenancy support.
</p>
<h3 class="wikiHeadline1" id="H-Multitenancy"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-Multitenancy">Multi-tenancy</a></h3>
<p class="wikiPara">
This feature was available since some time in Hibernate ORM, but while Hibernate Search would not prevent you to use it, it wouldn't apply the same strict isolation on full-text queries.
This is all implemented now, and is <a href="http://docs.jboss.org/hibernate/search/5.2/reference/en-US/html_single/#section-multi-tenancy" target="" class="regularLink">super easy to use</a>.
</p>
<h3 class="wikiHeadline2" id="H-HowToUseIt"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-HowToUseIt">How to use it</a></h3>
<p class="wikiPara">
It's not different than any usage of Hibernate ORM's multi-tenancy. After you open a tenant-aware 'Session', changes will be tagged as belonging to a specific tenant automatically.
When performing a full-text query, you'll only get results from the current tenant.
When rebuilding the index using the MassIndexer, it will rebuild only the index from the current tenant. When performing a <q>purgeAll</q> operation, it will only delete entries which belong to the current tenant.
</p>
<h3 class="wikiHeadline2" id="H-ImplementationAndShardingConsiderations"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-ImplementationAndShardingConsiderations">Implementation and Sharding considerations</a></h3>
<p class="wikiPara">
In this implementation, as suggested by some of you we didn't create a fully independent index for each tenant, but each Document in the index gets <q>tagged</q> by the tenantid.
</p>
<p class="wikiPara">
I am wondering if we should also implement a variation in which we keep each tenant's data into a fully independent index: please let us know what you think about that. The current approach of a single index works better if you have a very high amount of tenants, as there are practical limits in how many indexes can be managed. Another benefit of the current approach, is that you can easily plug in a clever custom sharding implementation; by working on a modulo approach among a list of tenants, you can tune it for a reasonable level of separation without necessarily having as many indexes as tenants.
</p>
<h3 class="wikiHeadline1" id="H-PerformanceOnPolymorphicEntityLoading"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-PerformanceOnPolymorphicEntityLoading">Performance on polymorphic entity loading</a></h3>
<p class="wikiPara">
The performance improvement highlight of the month goes to a revisited strategy on our internal usage of criterias when loading polymorphic results. If you were loading full-text results from a non-trivial class hierarchy you might notice a sweet performance improvement. For more details see <a href="https://hibernate.atlassian.net/browse/HSEARCH-1793" target="" class="regularLink">HSEARCH-1793</a>.
</p>
<h3 class="wikiHeadline1" id="H-MassIndexerNowSupportingACancelOperation"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-MassIndexerNowSupportingACancelOperation">MassIndexer now supporting a Cancel operation</a></h3>
<p class="wikiPara">
The async variation of the MassIndexer returns a Future, but this didn't implement the <u>cancel</u> operation. Many thanks to Yoann Gendre for implementing it!
</p>
<h3 class="wikiHeadline1" id="H-OtherImprovements"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-OtherImprovements">Other improvements</a></h3>
<p class="wikiPara">
For the list of minor improvements, please refer to <a href="https://github.com/hibernate/hibernate-search/blob/5.2.0.Beta1/changelog.txt#L4" target="" class="regularLink">the changelog</a>.
</p>
<h3 class="wikiHeadline1" id="H-GetTheUpdate"><a href="http://in.relation.to/2015/04/17/multi-tenancy-for-hibernate-search-users-520-beta-1-released#H-GetTheUpdate">Get the update!</a></h3>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.2.0.Beta1" target="" class="regularLink">full distribution from here</a>, or get it from Maven Central, and don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.</p>
</div>
http://in.relation.to/2015/04/16/hibernate-orm-439-final-4218-final-and-4219-final-released/Hibernate ORM 4.3.9.Final, 4.2.18.Final, and 4.2.19.Final Released2015-04-16T00:00:00Z2015-04-16T00:00:00ZGail Badner
4.3.9.Final and 4.2.19.Final were released 15/Apr/2015.
4.2.18.Final was actually released 28/Jan/2015. At the time of that release there were problems with in.relation.to. Unfortunately, after those issues were resolved, the announcement for 4.2.18.Final fell through the cracks, so I am covering that release here as well.
4.3.9.Final change log: https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&version=18953
4.2.18.Final change log: https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&version=18952
4.2.19.Final change log: https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&version=19152
4.2.18.Final and 4.2.19.Final fixes several regressions. Those fixes were also included in 4.3.9.Final.
4.3.9.Final includes mainly bugfixes with some improvements:
improved support for AttributeConverters (backported from 5.0.0.Beta1);
EntityGraph bugfixes;
fixes for load plan bugs that caused problems with CompositeCustomType IDs, embeddable @MapKey, maps containing embeddable...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
4.3.9.Final and 4.2.19.Final were released 15/Apr/2015.
</p>
<p class="wikiPara">
4.2.18.Final was actually released 28/Jan/2015. At the time of that release there were problems with in.relation.to. Unfortunately, after those issues were resolved, the announcement for 4.2.18.Final fell through the cracks, so I am covering that release here as well.
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> 4.3.9.Final change log: <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=18953" target="" class="regularLink">https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=18953</a>
</li>
<li class="wikiUnorderedListItem"> 4.2.18.Final change log: <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=18952" target="" class="regularLink">https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=18952</a>
</li>
<li class="wikiUnorderedListItem"> 4.2.19.Final change log: <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=19152" target="" class="regularLink">https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10031&amp;version=19152</a>
</li>
</ul>
<p class="wikiPara">
4.2.18.Final and 4.2.19.Final fixes several regressions. Those fixes were also included in 4.3.9.Final.
</p>
<p class="wikiPara">
4.3.9.Final includes mainly bugfixes with some improvements:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> improved support for AttributeConverters (backported from 5.0.0.Beta1);</li>
<li class="wikiUnorderedListItem"> EntityGraph bugfixes;</li>
<li class="wikiUnorderedListItem"> fixes for load plan bugs that caused problems with CompositeCustomType IDs, embeddable @MapKey, maps containing embeddable keys;</li>
<li class="wikiUnorderedListItem"> fix for a classloading bug that affects Hibernate under GlassFish 4.0 <a href="https://hibernate.atlassian.net/browse/HHH-9446" target="" class="regularLink">HHH-9446</a> that was introduced by in 4.3.6 by <a href="https://hibernate.atlassian.net/browse/HHH-8818" target="" class="regularLink">HHH-8818</a>; by setting an environment variable, Hibernate reverts to pre-<a href="https://hibernate.atlassian.net/browse/HHH-8818" target="" class="regularLink">HHH-8818</a> behavior;</li>
<li class="wikiUnorderedListItem"> fix for Envers to work with dynamic (non-POJO) entities.</li>
</ul>
<p class="wikiPara">
JBoss Nexus: <a href="https://repository.jboss.org/nexus/content/groups/public/org/hibernate" target="" class="regularLink">https://repository.jboss.org/nexus/content/groups/public/org/hibernate</a><br>
Maven Central: <a href="http://repo1.maven.org/maven2/org/hibernate/hibernate-core" target="" class="regularLink">http://repo1.maven.org/maven2/org/hibernate/hibernate-core</a> (should update in a couple of days)<br>
</p>
<p class="wikiPara">
SourceForge: <a href="https://sourceforge.net/projects/hibernate/files/hibernate4" target="" class="regularLink">https://sourceforge.net/projects/hibernate/files/hibernate4</a><br>
4.3.9.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.9.Final/hibernate-release-4.3.9.Final.zip/download" target="" class="regularLink">4.3.9.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.9.Final/hibernate-release-4.3.9.Final.tgz/download" target="" class="regularLink">4.3.9.Final TGZ</a><br>
4.2.18.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.18.Final/hibernate-release-4.2.18.Final.zip/download" target="" class="regularLink">4.2.18.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.18.Final/hibernate-release-4.2.18.Final.tgz/download" target="" class="regularLink">4.2.18.Final TGZ</a><br>
4.2.19.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.19.Final/hibernate-release-4.2.19.Final.zip/download" target="" class="regularLink">4.2.19.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.19.Final/hibernate-release-4.2.19.Final.tgz/download" target="" class="regularLink">4.2.19.Final TGZ</a><br></p>
</div>
http://in.relation.to/2015/04/02/jboss-community-asylum-feeding-a-henry/JBoss Community Asylum - Feeding a Henry2015-04-02T00:00:00Z2015-04-02T00:00:00ZMax Andersen
While we were in Newcastle for a meetup we sat down with John, Mícheál and John about FeedHenry,
what it is and how it is going with the opensourcing of their platform.
Also you will hear how the name is tied to royalty!
Find it all in the
Show notes and episode.
Have fun!
...
<div id="documentDisplay" class="documentDisplay">
<img src="http://in.relation.to/images/legacy/13429.jpeg" align="left" style="padding-right: 15px; width: 150px;">
<p class="wikiPara">
While we were in Newcastle for a meetup we sat down with John, Mícheál and John about FeedHenry,
what it is and how it is going with the opensourcing of their platform.
</p>
<p class="wikiPara">
Also you will hear how the name is tied to royalty!
</p>
<p class="wikiPara">
Find it all in the
<a href="http://jbosscommunityasylum.libsyn.com/podcast-38-feeding-a-henry" target="" class="regularLink">Show notes and episode</a>.
</p>
<p class="wikiPara">
Have fun!
</p>
</div>
http://in.relation.to/2015/03/31/hibernate-orm-500-beta-1-release/Hibernate ORM 5.0.0.Beta1 Release2015-03-31T00:00:00Z2015-03-31T00:00:00ZSteve Ebersole
We just got done releasing Hibernate O/RM 5.0.0.Beta1. I will follow up later with a more in depth blog post for 5.0.0.Final, but this first Beta implements all new APIs and most new features. Specifically in this Beta include:
New bootstrapping API - better determinism, better integration
Java 8 Support (though still compatible with Java 6). Just add hibernate-java8 to your classpath.
Ability to handle additional Java types for id attributes marked as GenerationType#AUTO. Built-in support for Number and UUID. Expandable via new org.hibernate.boot.model.IdGeneratorStrategyInterpreter extension
scanning support for non-JPA usage
NamingStrategy has been removed in...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
We just got done releasing Hibernate O/RM 5.0.0.Beta1. I will follow up later with a more in depth blog post for 5.0.0.Final, but this first Beta implements all new APIs and most new features. Specifically in this Beta include:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> New bootstrapping API - better determinism, better integration</li>
<li class="wikiUnorderedListItem"> Java 8 Support (though still compatible with Java 6). Just add hibernate-java8 to your classpath.</li>
<li class="wikiUnorderedListItem"> Ability to handle additional Java types for id attributes marked as <tt>GenerationType#AUTO</tt>. Built-in support for Number and UUID. Expandable via new <tt>org.hibernate.boot.model.IdGeneratorStrategyInterpreter</tt> extension</li>
<li class="wikiUnorderedListItem"> scanning support for non-JPA usage</li>
<li class="wikiUnorderedListItem"> NamingStrategy has been removed in favor of a better designed API. 2 actually: <tt>org.hibernate.boot.model.naming.ImplicitNamingStrategy</tt> and <tt>org.hibernate.boot.model.naming.PhysicalNamingStrategy</tt>
</li>
</ul>
<p class="wikiPara">
Additionally, support for AttributeConverters has been expanded and more fully realized:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> fully supported for non-<tt>@Enumerated</tt> enum values</li>
<li class="wikiUnorderedListItem"> applicable in conjunction with <tt>@Nationalized</tt> support</li>
<li class="wikiUnorderedListItem"> called to handle null values</li>
<li class="wikiUnorderedListItem"> settable in hbm.xml by using <tt>type="converter:fully.qualified.AttributeConverterName"</tt>
</li>
<li class="wikiUnorderedListItem"> integrated with hibernate-envers</li>
<li class="wikiUnorderedListItem"> collection values, map keys</li>
</ul>
<p class="wikiPara">
See <a href="http://hibernate.org/orm/downloads/" target="" class="regularLink">http://hibernate.org/orm/downloads/</a> for information on obtaining Hibernate ORM.
</p>
<p class="wikiPara">
<i class="wikiEmphasis">NOTE: 5.0 is expected to be compatible with Java 6 (aside from the hibernate-java8 module naturally). However, Beta1 will not work with Java 6 due to something with JAXB that I have not yet had time to investigate. Beta1 requires Java 7. Again, the expectation is to have it be compatible with Java 6 by the next release if possible.</i></p>
</div>
http://in.relation.to/2015/03/23/entre-devoxx-france-gagner-free-pass-for-devoxx-france/Entrée Devoxx France à Gagner - Free pass for Devoxx France2015-03-23T00:00:00Z2015-03-23T00:00:00ZEmmanuel Bernard
Célébrons l'open source et le partage (English version below).
Place pour Devoxx France à gagner
Devoxx France vous offre une place: je ne suis que le messager :) Elle sera gagnée par l'un d'entre vous.
La règle est simple.
Contribuer à un projet open source (code, doc, etc) entre maintenant et dimanche 29 mars 2015 et tweeter le lien vers la pull request ou le patch à @Hibernate.
Quel projet ? N'importe pourvu que la licence soit open source. Donc pas limité à Hibernate.
Comment sera choisi le vainqueur ? La contribution que je préfère sera choisie. Super bonus si c'est votre première contribution...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Célébrons l'open source et le partage (English version below).
</p>
<h3 class="wikiHeadline2" id="H-PlacePourDevoxxFranceGagner"><a href="http://in.relation.to/2015/03/23/entre-devoxx-france-gagner-free-pass-for-devoxx-france#H-PlacePourDevoxxFranceGagner">Place pour Devoxx France à gagner</a></h3>
<p class="wikiPara">
<a href="http://www.devoxx.fr" target="" class="regularLink">Devoxx France</a> vous offre une place: je ne suis que le messager :) Elle sera gagnée par l'un d'entre vous.
La règle est simple.
</p>
<p class="wikiPara">
<i class="wikiEmphasis">Contribuer à un projet open source (code, doc, etc) entre maintenant et dimanche 29 mars 2015 et tweeter le lien vers la pull request ou le patch à <tt>@Hibernate</tt>.</i>
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Quel projet ? N'importe pourvu que la licence soit open source. Donc pas limité à Hibernate.</li>
<li class="wikiUnorderedListItem"> Comment sera choisi le vainqueur ? La contribution que je préfère sera choisie. Super bonus si c'est votre première contribution à ce projet : il faut que ça brasse :)</li>
<li class="wikiUnorderedListItem"> Mais si on contribue à un projet Red Hat, on a plus de chance ? Non, tous les projets open source sont (libres et) égaux.</li>
<li class="wikiUnorderedListItem"> Je suis employé Red Hat, je peux gagner? Non. Contacte-moi directement.</li>
<li class="wikiUnorderedListItem"> Et ? C'est tout.</li>
</ul>
<p class="wikiPara">
Devoxx France se déroule du 8 au 10 avril à Paris (Palais des Congrès).
J'y parlerai entre autre des sujets <a href="http://goo.gl/IBHXGL" target="" class="regularLink">Object Mappers dans le NoSQL</a> et <a href="http://cfp.devoxx.fr/2015/talk/YOK-7115/Hibernate_BoF" target="" class="regularLink">une BoF Hibernate</a>.
</p>
<p class="wikiPara">
Aller au boulot !
</p>
<h3 class="wikiHeadline2" id="H-FreePassForDevoxxFrance"><a href="http://in.relation.to/2015/03/23/entre-devoxx-france-gagner-free-pass-for-devoxx-france#H-FreePassForDevoxxFrance">Free pass for Devoxx France</a></h3>
<p class="wikiPara">
<a href="http://www.devoxx.fr" target="" class="regularLink">Devoxx France</a> is giving away a free pass through me. I am just the messenger :) One of you will win it. The rule is simple.
</p>
<p class="wikiPara">
<i class="wikiEmphasis">Contribute to an open source project (code, doc, etc) between now and Sunday evening 29th of March 2015 and tweet the link to the pull request or the patch to <tt>@Hibernate</tt>.</i>
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Which project? Any project released under an open source license. Not limited to Hibernate.</li>
<li class="wikiUnorderedListItem"> How will you chose the winner? The contribution I prefer will be chosen. Extra bonus if that's your first contribution on that project: let's exchange!</li>
<li class="wikiUnorderedListItem"> But if I contribute to a Red Hat project, I have a better chance? No, all open source projects are equals.</li>
<li class="wikiUnorderedListItem"> I am a Red Hat employee, can I win? No. Contact me directly instead.</li>
</ul>
<p class="wikiPara">
Devoxx France happens in Paris from the 8th to the 10th of April.
I will be speaking about a few topics including <a href="http://goo.gl/IBHXGL" target="" class="regularLink">Object Mappers and NoSQL</a> and an <a href="http://cfp.devoxx.fr/2015/talk/YOK-7115/Hibernate_BoF" target="" class="regularLink">Hibernate BoF</a>.
</p>
<p class="wikiPara">
Now go contribute!
</p>
<p class="wikiPara">
PS légal: cette place est offerte par Devoxx France et Emmanuel Bernard à titre personnel, pas par Red Hat. Bref, je fais ce que je veux, avec mes cheveux.
Legal PS: this pass if given away by Devoxx France and Emmanuel Bernard as an individual and free human being, not Red Hat.</p>
</div>
http://in.relation.to/2015/03/19/a-community-improved-version-of-hibernate-search-511-final/A community improved version of Hibernate Search: 5.1.1.Final2015-03-19T00:00:00Z2015-03-19T00:00:00ZSanne Grinovero
We released Hibernate Search 5.1.1.Final, a micro update for version 5.1: our latest best release ever which we described early this month.
Special thanks to:
Török László for fixing a subtle bug in NullEncodingTwoWayFieldBridge
Russell Dickenson for fixing many typos in the documentation
Thach Hoang for improving javadoc of the @Spatial annotation
Besides the above fixes, a good reason to publish this release already was HSEARCH-1824. This problem won't affect you as Hibernate user but was a blocker to update the Infinispan Query engine to Hibernate Search 5.1.x.
Remember you can annotate any Java pojo - even not Hibernate entities - and have them indexed and...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
We released <i class="wikiEmphasis">Hibernate Search 5.1.1.Final</i>, a micro update for version 5.1: our latest best release ever which <a href="http://in.relation.to/2015/03/04/hibernate-search-51" target="" class="regularLink">we described early this month</a>.
</p>
<p class="wikiPara">
Special thanks to:
</p>
<p class="wikiPara">
<i class="wikiEmphasis">Török László</i> for fixing a subtle bug in <i class="wikiEmphasis">NullEncodingTwoWayFieldBridge</i>
</p>
<p class="wikiPara">
<i class="wikiEmphasis">Russell Dickenson</i> for fixing many typos in the documentation
</p>
<p class="wikiPara">
<i class="wikiEmphasis">Thach Hoang</i> for improving javadoc of the <i class="wikiEmphasis">@Spatial</i> annotation
</p>
<p class="wikiPara">
Besides the above fixes, a good reason to publish this release already was <a href="https://hibernate.atlassian.net/browse/HSEARCH-1824" target="" class="regularLink">HSEARCH-1824</a>. This problem won't affect you as Hibernate user but was a blocker to update the Infinispan Query engine to Hibernate Search 5.1.x.
</p>
<p class="wikiPara">
Remember you can annotate any Java pojo - even not Hibernate entities - and <a href="http://infinispan.org/docs/7.1.x/user_guide/user_guide.html#sid-68355061" target="" class="regularLink">have them indexed and queried as usual when you store them in Infinispan</a>.
</p>
<h3 class="wikiHeadline1" id="H-GetUpdated"><a href="http://in.relation.to/2015/03/19/a-community-improved-version-of-hibernate-search-511-final#H-GetUpdated">Get updated!</a></h3>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.1.1.Final" target="" class="regularLink">full distribution from here</a>, or get it from Maven Central, and don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.
</p>
<h3 class="wikiHeadline3" id="H-Stackoverflow"><a href="http://in.relation.to/2015/03/19/a-community-improved-version-of-hibernate-search-511-final#H-Stackoverflow">Stackoverflow</a></h3>
<p class="wikiPara">
If you prefer to use <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">stackoverflow.com</a>, please use the tag <i class="wikiEmphasis">hibernate-search</i>.
And if you have a moment to help other users, some please consider registering to the <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">hibernate-search</a> tag to help us answering all the questions.
</p>
<p class="wikiPara">
If you are new to Hibernate Search, best is to start with our <a href="http://hibernate.org/search/documentation/getting-started/" target="" class="regularLink">getting started guide</a>. And remember: feedback, comments and/or <a href="https://github.com/hibernate/hibernate.org" target="" class="regularLink">pull-requests</a> are welcome on the website too.</p>
</div>
http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released/Hibernate OGM times 2: 4.1.3 and 4.2 Beta1 released2015-03-17T00:00:00Z2015-03-17T00:00:00ZGunnar Morling
I am happy to announce the release of Hibernate OGM 4.1.3 Final and 4.2.0.Beta1!
The former brings several usability improvements, bug fixes and component upgrades, whereas the latter comes with new query features, an error handling API for non-transactional datastores and more.
The releases can be obtained as ZIP or TAR.GZ from SourceForge (4.1.3.Final, 4.2.0.Beta1) or via Maven, Gradle etc., using the following GAV coordinates:
org.hibernate.ogm:hibernate-ogm-core:4.1.3.Final or org.hibernate.ogm:hibernate-ogm-core:4.2.0.Beta1 for the Hibernate OGM engine and
org.hibernate.ogm:hibernate-ogm-<%DATASTORE%>:4.1.3.Final or org.hibernate.ogm:hibernate-ogm-<%DATASTORE%>:4.2.0.Beta1, depending on the backend you want to use.
Note that from 4.2 onwards, Hibernate OGM requires Java 7. We aimed at Java 6 compatibility for as...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
I am happy to announce the release of Hibernate OGM 4.1.3 Final and 4.2.0.Beta1!
</p>
<p class="wikiPara">
The former brings several usability improvements, bug fixes and component upgrades, whereas the latter comes with new query features, an error handling API for non-transactional datastores and more.
</p>
<p class="wikiPara">
The releases can be obtained as ZIP or TAR.GZ from SourceForge (<a href="https://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.3.Final/" target="" class="regularLink">4.1.3.Final</a>, <a href="https://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.2.0.Beta1/" target="" class="regularLink">4.2.0.Beta1</a>) or via Maven, Gradle etc., using the following GAV coordinates:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.1.3.Final</i> or <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.2.0.Beta1</i> for the Hibernate OGM engine and</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.1.3.Final</i> or <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.2.0.Beta1</i>, depending on the backend you want to use.</li>
</ul>
<p class="wikiPara">
Note that from 4.2 onwards, <b>Hibernate OGM requires Java 7</b>. We aimed at Java 6 compatibility for as long as possible, but with more and more of our backends and components requiring Java 7 (e.g. Neo4j and Lucene), we felt that it was time to move on and take advantage of the Java 7 goodies for the Hibernate OGM code base as well.
</p>
<p class="wikiPara">
Let's dive into some of the new functionality of the 4.2 Beta1 release.
</p>
<h3 class="wikiHeadline3" id="H-QueryImprovements"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released#H-QueryImprovements">Query improvements</a></h3>
<p class="wikiPara">
We continued our quest for extensive query capabilities and enabled more JP-QL constructs, namely queries on element collections. For example consider the following entity <tt>Order</tt> which contains an element collection of its order lines:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
public class Order {
@Id
@GeneratedValue
private long id;
@ElementCollection
private List&lt;OrderLine&gt; orderLines = new ArrayList&lt;&gt;();
// getter, setters etc. ...
}
@Embeddable
public class OrderLine {
private String item;
private BigDecimal price;
// getter, setters etc. ...
}</pre>
<p class="wikiPara">
To obtain a list of all orders which contain a wooden toy train order line, you could run the following JP-QL query:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">List&lt;Order&gt; toyTrainOrders = entityManager
.createQuery( "FROM Order o JOIN o.orderLines ol WHERE ol.item LIKE '%wooden toy train%'" )
.getResultList();</pre>
<p class="wikiPara">
As with other JP-QL queries, Hibernate OGM will convert the query string into a native query for MongoDB and Neo4j. For the other backends a Lucene-based full-text query will be created.
</p>
<p class="wikiPara">
Note that the JOIN syntax at this point is only supported for element collections, i.e. you cannot create join queries for arbitrary associations to other entities. The reason is that most NoSQL stores don't support joins between different tables/collections, therefore such query can't be translated in a sensible way. An exception are graph databases such as Neo4j where joins can be converted into queries based on relationships (which is what actually happens for the element collection case), but we are not quite there yet :)
</p>
<h3 class="wikiHeadline3" id="H-APIForRetrievingAllExecutedAndFailedDatastoreOperations"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released#H-APIForRetrievingAllExecutedAndFailedDatastoreOperations">API for retrieving all executed and failed datastore operations</a></h3>
<p class="wikiPara">
Hibernate ORM collects all write operations internally and propagates them to the database in most cases only upon transaction commit (in addition, changes will also be flushed prior to query execution or upon explicite <tt>flush()</tt> calls). This enables many optimizations such as batched inserts. Hibernate OGM follows this approach and also uses transaction boundaries for demarcating units of work and triggering writes to the datastore.
</p>
<p class="wikiPara">
While this naturally works great with transactional NoSQL stores such as Infinispan or Neo4j, it poses some challenges on non-transactional datastores. The 4.2 release therefore provides the initial draft of an API which notifies you upon failed datastore operations, letting you take appropriate action such as e.g. logging all previously applied operations or retrying a failed operation.
</p>
<p class="wikiPara">
In order to not let this release announcement grow too big, there is a <a href="http://in.relation.to/2015/03/17/hibernate-ogm-error-handling-on-nontransactional-no-sql-stores" target="" class="regularLink">separate post</a> just dedicated to this new API.
</p>
<h3 class="wikiHeadline3" id="H-SupportForFongo"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released#H-SupportForFongo">Support for Fongo</a></h3>
<p class="wikiPara">
<a href="https://github.com/fakemongo/fongo" target="" class="regularLink">Fongo</a> ("Fake Mongo") is a very nice tool when it comes to testing MongoDB applications. It provides a pure in-memory implementation of the MongoDB Java API which allows to test MongoDB-based applications without starting up an actual MongoDB instance.
</p>
<p class="wikiPara">
Thanks to community member <a href="https://twitter.com/alexsotob" target="" class="regularLink">Alex Soto</a>, you can use Fongo now also for testing your Hibernate OGM based application. To do so, simply add the following dependencies to your project (assuming you work with Maven and have added the Hibernate OGM BOM to the <i class="wikiEmphasis">dependencyManagement</i> block of your POM file):
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-mongodb&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.github.fakemongo&lt;/groupId&gt;
&lt;artifactId&gt;fongo&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;</pre>
<p class="wikiPara">
Then specify "fongodb" as the Hibernate OGM datastore provider, e.g. via a persistence unit property in <i class="wikiEmphasis">META-INF/persistence.xml</i>:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;persistence-unit name="example-PU" transaction-type="RESOURCE_LOCAL"&gt;
&lt;provider&gt;org.hibernate.ogm.jpa.HibernateOgmPersistence&lt;/provider&gt;
&lt;properties&gt;
&lt;property name="hibernate.ogm.datastore.provider" value="fongodb"/&gt;
&lt;/properties&gt;
&lt;/persistence-unit&gt;</pre>
<p class="wikiPara">
Hibernate OGM will now use Fongo rather than a real MongoDB server as the backend. As said, this can be quite handy when testing your application, just do not forget to switch to a real datastore when deploying to production ;-)
</p>
<h3 class="wikiHeadline3" id="H-UsabilityImprovements"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released#H-UsabilityImprovements">Usability improvements</a></h3>
<p class="wikiPara">
Finally, let's take a quick look at two nice usability improvements which you already get with the update to 4.1.3.
</p>
<p class="wikiPara">
The first is a better support for the <tt>RESOURCE_LOCAL</tt> transaction type when working with stores such as MongoDB under Java SE. As described above, Hibernate OGM relies on transaction demarcation to gather data changes and write them to the datastore in an optimized way. This used to require a JTA implementation on the classpath, also if the underlying datastore actually is not transactional. This is obsolete now, i.e. you can work with <tt>RESOURCE_LOCAL</tt> and MongoDB, CouchDB etc. without any further dependencies.
</p>
<p class="wikiPara">
If you work with Hibernate OGM and Hibernate Search, you will be happy to learn that the creation of full-text queries became easier. It is not necessary any longer to configure the database retrieval method for each and every <tt>FullTextQuery</tt>, instead this happens automatically on a global level now when bootstrapping the Hibernate OGM engine.
</p>
<h3 class="wikiHeadline3" id="H-SomeUsefulLinks"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-times-2413-and-42-beta-1-released#H-SomeUsefulLinks">Some useful links</a></h3>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Change logs: <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10160&amp;version=19251" target="" class="regularLink">4.1.3</a>, <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10160&amp;version=19050" target="" class="regularLink">4.2 Beta1</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">User forum</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/browse/OGM" target="" class="regularLink">Issue tracker</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://lists.jboss.org/pipermail/hibernate-dev/" target="" class="regularLink">Mailing list</a>
</li>
</ul>
</div>
http://in.relation.to/2015/03/17/hibernate-ogm-error-handling-on-nontransactional-no-sql-stores/Hibernate OGM: Error handling on non-transactional NoSQL stores2015-03-17T00:00:00Z2015-03-17T00:00:00ZGunnar Morling
One of the fundamental principles of Hibernate/JPA is that any writes done through the Session/EntityManager APIs are collected in the persistence context and are only written to the database upon transaction commit. If needed, you can enforce the flushing of changes by explicitly invoking the flush() method. Also Hibernate may trigger a flush automatically, e.g. prior to executing a query. This strategy allows to perform many optimizations, e.g. only persisting the final state of an entity changed several times, make use of batched inserts and others.
Hibernate OGM follows this approach and uses transaction boundaries for demarcating units of work and...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
One of the fundamental principles of Hibernate/JPA is that any writes done through the <tt>Session</tt>/<tt>EntityManager</tt> APIs are collected in the <i class="wikiEmphasis">persistence context</i> and are only written to the database upon transaction commit. If needed, you can enforce the flushing of changes by explicitly invoking the <tt>flush()</tt> method. Also Hibernate may trigger a flush automatically, e.g. prior to executing a query. This strategy allows to perform many optimizations, e.g. only persisting the final state of an entity changed several times, make use of batched inserts and others.
</p>
<p class="wikiPara">
Hibernate OGM follows this approach and uses transaction boundaries for demarcating units of work and triggering writes to the datastore. Naturally, this works just fine on transactional NoSQL stores such as Infinispan or Neo4j, but it poses some challenges on stores without full transactional semantics.
</p>
<p class="wikiPara">
For instance consider a method of a stateless EJB (which automatically runs within a container-managed transaction) which inserts three entities. If an error occurs when inserting the last entity, the other two will already have been written. When using a non-transactional datastore, there is no way to rollback these already applied changes. Depending on the specific use case, this may be acceptable; But in other cases it is desirable to take some action, for example retrying the failed insertion or performing compensating writes for the succeeded insertions, effectively undoing them.
</p>
<p class="wikiPara">
This is where our new <a href="http://docs.jboss.org/hibernate/ogm/4.2/reference/en-US/html_single/#ogm-api-error-handler" target="" class="regularLink">error handling API</a> comes in. It allows you to get notified upon failed datastore operations or transaction rollback attempts, providing you with the executed and failed operation(s). This e.g. enables you to:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> log all applied operations</li>
<li class="wikiUnorderedListItem"> retry a failed operation (e.g. after timeouts)</li>
<li class="wikiUnorderedListItem"> make an attempt to compensate applied changes (by executing an inverse operation)</li>
</ul>
<h3 class="wikiHeadline3" id="H-AnExampleErrorHandler"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-error-handling-on-nontransactional-no-sql-stores#H-AnExampleErrorHandler">An example error handler</a></h3>
<p class="wikiPara">
Let’s take a look at an example:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">public class ExampleErrorHandler implements ErrorHandler {
@Override
public void onRollback(RollbackContext context) {
// write all applied operations to a log file
for ( GridDialectOperation appliedOperation : context.getAppliedGridDialectOperations() ) {
switch ( appliedOperation.getType() ) {
case INSERT_TUPLE:
EntityKeyMetadata entityKeyMetadata = appliedOperation.as( InsertTuple.class ).getEntityKeyMetadata();
Tuple tuple = appliedOperation.as( InsertTuple.class ).getTuple();
// write EKM and tuple to log file...
break;
case REMOVE_TUPLE:
// ...
break;
case ...
// ...
break;
}
}
}
@Override
public ErrorHandlingStrategy onFailedGridDialectOperation(FailedGridDialectOperationContext context) {
// Ignore this exception and continue
if ( context.getException() instanceof TupleAlreadyExistsException ) {
GridDialectOperation failedOperation = context.getFailedOperation();
// write to log ...
return ErrorHandlingStrategy.CONTINUE;
}
// But abort on all others
else {
return ErrorHandlingStrategy.ABORT;
}
}
}</pre>
<p class="wikiPara">
The <tt>onRollback()</tt> method - which is called when the transaction (or unit of work) is rolled back (either by the user or by the container) - shows how to iterate over all datastore operations applied prior to the rollback attempt, examine their specific type and e.g. write them to a log file.
</p>
<p class="wikiPara">
The <tt>onFailedGridDialectOperation()</tt> method is called for each specific datastore operation failing. It lets you decide whether to continue - ignoring the failure - or abort the operation. If <tt>ABORT</tt> is returned, the causing exception will be re-thrown, eventually causing the current transaction to be rolled back. If <tt>CONTINUE</tt> is returned, that exception will be ignored, causing the current transaction to continue.
</p>
<p class="wikiPara">
The decision whether to abort or continue can be based on the specific exception type or on the grid dialect operation which caused the failure. In the example all exceptions of type <tt>TupleAlreadyExistsException</tt> are ignored (meaning we don't care about duplicate records being inserted into the datastore), whereas all other exceptions cause the current unit of work to be aborted. You also could react to datastore-specific exceptions such as MongoDB’s <tt>MongoTimeoutException</tt>, if needed.
</p>
<p class="wikiPara">
Having created the <tt>ErrorHandler</tt> implementation, it needs to be registered with Hibernate OGM. You can do so for instance using a persistence unit property in <i class="wikiEmphasis">META-INF/persistence.xml</i>:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;property name="hibernate.ogm.error_handler" value="com.example.ExampleErrorHandler"/&gt;</pre>
<h3 class="wikiHeadline3" id="H-FeedbackNeeded"><a href="http://in.relation.to/2015/03/17/hibernate-ogm-error-handling-on-nontransactional-no-sql-stores#H-FeedbackNeeded">Feedback needed!</a></h3>
<p class="wikiPara">
In its current form the API lays the ground for manually performing tasks such as retrying, logging and similar. But we envision a more automated approach in future versions, e.g. for automatic retries of failed operations.
</p>
<p class="wikiPara">
Of course this API can and will not bring transactional guarantees to datastores which don't support them natively. If you find yourself frequently in a situation where you wish for transactional "all or nothing" semantics, you might consider to move to a datastore which actually provides this functionality. But you also may look into more suitable mapping approaches. For instance embeddables and element collections are a great way for ensuring atomicity of an entity and dependent structures on document stores such as MongoDB or CouchDB, as they will be mapped to a single, hierarchically structured document which can updated with a single datastore call.
</p>
<p class="wikiPara">
At this point, the API is considered experimental and will evolve in future releases. For this, your input is very important to us! Let us know what you would like to do with such an API and what functionality should be added. Just tweet to <a href="https://twitter.com/hibernate" target="" class="regularLink">@Hibernate</a> or send a mail to our <a href="https://lists.jboss.org/mailman/listinfo/hibernate-dev" target="" class="regularLink">development list</a>. If you like, you also may add comments to the JIRA issues addressing further development of the API: <a href="https://hibernate.atlassian.net/browse/OGM-775" target="" class="regularLink">OGM-775</a> ("Introduce RETRY error handling strategy"), <a href="https://hibernate.atlassian.net/browse/OGM-776" target="" class="regularLink">OGM-776</a> ("Provide means for executing compensating actions") and <a href="https://hibernate.atlassian.net/browse/OGM-777" target="" class="regularLink">OGM-777</a> ("Expose more context information via error handler contexts").
</p>
<p class="wikiPara">
Any feedback is greatly appreciated!</p>
</div>
http://in.relation.to/2015/03/04/hibernate-search-51/Hibernate Search 5.12015-03-04T00:00:00Z2015-03-04T00:00:00ZSanne Grinovero
Now that feedback is coming about our great 5.0 release, it's time to publish quite a maintenance version as we have a long list of improvements already! So today we release Hibernate Search 5.1.0.Final.
Performance improvements
The indexing engine learned yet another smart trick, and is going to generate more efficient delete and update operations in case you have a non-trivial hierarchy of entities being mapped.
See also HSEARCH-1767 for more details.
This might not affect you at all, or it might give you a very significant performance boost!
Also affecting performance, the caching code for Filters improved and this might result in a higher...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Now that feedback is coming about our great 5.0 release, it's time to publish quite a maintenance version as we have a long list of improvements already! So today we release <i class="wikiEmphasis">Hibernate Search 5.1.0.Final</i>.
</p>
<h2 class="wikiHeadline2" id="H-PerformanceImprovements"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-PerformanceImprovements">Performance improvements</a></h2>
<p class="wikiPara">
The indexing engine learned yet another smart trick, and is going to generate more efficient delete and update operations in case you have a non-trivial hierarchy of entities being mapped.
See also <a href="https://hibernate.atlassian.net/browse/HSEARCH-1767" target="" class="regularLink">HSEARCH-1767</a> for more details.
This might not affect you at all, or it might give you a very significant performance boost!
</p>
<p class="wikiPara">
Also affecting performance, the caching code for Filters improved and this might result in a higher cache hit ratio.
</p>
<h2 class="wikiHeadline2" id="H-ManyUsabilityImprovements"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-ManyUsabilityImprovements">Many usability improvements</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> It is no longer required to provide a key object for parameterized Filters (we'll figure it out automatically). (<a href="https://hibernate.atlassian.net/browse/HSEARCH-295" target="" class="regularLink">HSEARCH-295</a>)</li>
<li class="wikiUnorderedListItem"> You can now use annotations to declare Filters and Analyzers on packages or super classes! After all, these are global. (<a href="https://hibernate.atlassian.net/browse/HSEARCH-1763" target="" class="regularLink">HSEARCH-1763</a>, <a href="https://hibernate.atlassian.net/browse/HSEARCH-633" target="" class="regularLink">HSEARCH-633</a>)</li>
<li class="wikiUnorderedListItem"> When booting programmatically, you can now inject an instance of an <i class="wikiEmphasis">ErrorHandler</i> (<a href="https://hibernate.atlassian.net/browse/HSEARCH-1624" target="" class="regularLink">HSEARCH-1624</a>)</li>
<li class="wikiUnorderedListItem"> The programmatic configuration API was improved by adding some missing methods</li>
</ul>
<h2 class="wikiHeadline2" id="H-ProjectionBugfixes"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-ProjectionBugfixes">Projection: bugfixes</a></h2>
<p class="wikiPara">
There was a bug in projecting values of embeddable types which could strike occasionally, as it would trigger only on some specific iterations of the metadata, which is unsorted so it could manifest only occasionally. This is fixed now as <a href="https://hibernate.atlassian.net/browse/HSEARCH-1786" target="" class="regularLink">HSEARCH-1786</a>.
</p>
<p class="wikiPara">
Many thanks to Rustem Sagimbekov, Marc Schipperheyn and Ildar Mussin for reporting it and helping me diagnose the problem.
</p>
<h2 class="wikiHeadline2" id="H-Multitenancy"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-Multitenancy">Multi-tenancy</a></h2>
<p class="wikiPara">
Some users have recently been trying to use Hibernate Search combined with Hibernate ORM's multi-tenancy features. We have to admit this wasn't tested! We added a warning in the documentation, as some more work is going to be needed to make for a flawless integration experience.
</p>
<p class="wikiPara">
There was one blocker preventing people to use the MassIndexer <a href="https://hibernate.atlassian.net/browse/HSEARCH-1649" target="" class="regularLink">HSEARCH-1649</a> with multi-tenancy, which is fixed now. So while there are still <a href="http://docs.jboss.org/hibernate/search/5.1/reference/en-US/html_single/#search-architecture-multitenancy" target="" class="regularLink">some limitations documented here</a>, you should be able to move forward. Please let us know if more changes are needed (on top of the known limitations, which are easy to work around for now).
</p>
<h2 class="wikiHeadline2" id="H-OSGiImprovements"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-OSGiImprovements">OSGi improvements</a></h2>
<p class="wikiPara">
With 5.0 we published our first experimental support for depoying in OSGi, and it's maturing quickly thanks to all your feedback!
Thanks to Gustavo Nalle and Andy Phillips for the latest suggestions and improvements.
</p>
<h2 class="wikiHeadline2" id="H-Dropped"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-Dropped">Dropped</a></h2>
<p class="wikiPara">
The optional serialization module based on plain standard Java serialization was removed. Please use <i class="wikiEmphasis">hibernate-search-serialization-avro</i>, which has always been the better implementation. If you had strong reasons to love the plain java implementation, let us know.
</p>
<h2 class="wikiHeadline2" id="H-ComponentsUpgrades"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-ComponentsUpgrades">Components upgrades</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Apache Lucene released 4.10.4</li>
<li class="wikiUnorderedListItem"> Infinispan upgraded to 7.1.1</li>
</ul>
<h1 class="wikiHeadline1" id="H-GetItNow"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-GetItNow">Get it now!</a></h1>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.1.0.Final" target="" class="regularLink">full distribution from here</a>.
And don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.
</p>
<h3 class="wikiHeadline3" id="H-Stackoverflow"><a href="http://in.relation.to/2015/03/04/hibernate-search-51#H-Stackoverflow">Stackoverflow</a></h3>
<p class="wikiPara">
If you prefer to use <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">stackoverflow.com</a>, please use the tag <i class="wikiEmphasis">hibernate-search</i>.
And if you have a moment to help other users, some please consider registering to the <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">hibernate-search</a> tag to help us answering all the questions.
</p>
<p class="wikiPara">
If you are new to Hibernate Search, best is to start with our <a href="http://hibernate.org/search/documentation/getting-started/" target="" class="regularLink">getting started guide</a>. And remember: feedback, comments and/or <a href="https://github.com/hibernate/hibernate.org" target="" class="regularLink">pull-requests</a> are welcome on the website too.</p>
</div>
http://in.relation.to/2015/03/02/bug-fixes-around-jpql-and-more-hibernate-ogm-412-released/Bug fixes around JP-QL and more: Hibernate OGM 4.1.2 released2015-03-02T00:00:00Z2015-03-02T00:00:00ZGunnar Morling
It’s my pleasure to announce the release of Hibernate OGM 4.1.2!
This maintenance release fixes several bugs, e.g. around JP-QL, using Hibernate OGM in SaaS environments or mapping byte[] properties on CouchDB. We also clarified several issues in the reference guide. Many thanks to everyone test-driving Hibernate OGM and reporting bugs (and feature requests) to us!
As always you can get this release as ZIP or TAR.GZ from SourceForge or use the following GAV coordinates with your preferred build tool:
org.hibernate.ogm:hibernate-ogm-core:4.1.2.Final for the Hibernate OGM engine and
org.hibernate.ogm:hibernate-ogm-<%DATASTORE%>:4.1.2.Final, depending on the backend you want to use.
While preparing another release for fixing some...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
It’s my pleasure to announce the release of Hibernate OGM 4.1.2!
</p>
<p class="wikiPara">
This maintenance release fixes several bugs, e.g. <a href="https://hibernate.atlassian.net/browse/OGM-737" target="" class="regularLink">around JP-QL</a>, using Hibernate OGM <a href="https://hibernate.atlassian.net/browse/OGM-733" target="" class="regularLink">in SaaS environments</a> or mapping <a href="https://hibernate.atlassian.net/browse/OGM-735" target="" class="regularLink">byte[] properties</a> on CouchDB. We also clarified several issues in the <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/" target="" class="regularLink">reference guide</a>. Many thanks to everyone test-driving Hibernate OGM and reporting bugs (and feature requests) to us!
</p>
<p class="wikiPara">
As always you can get this release as ZIP or TAR.GZ from <a href="https://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.2.Final/" target="" class="regularLink">SourceForge</a> or use the following GAV coordinates with your preferred build tool:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.1.2.Final</i> for the Hibernate OGM engine and</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.1.2.Final</i>, depending on the backend you want to use.</li>
</ul>
<p class="wikiPara">
While preparing another release for fixing some more issues in Hibernate OGM 4.1, we take in parallel the first steps towards Hibernate OGM 4.2. You can expect many improvements in the field of JP-QL queries, support for custom types, an SPI for logging executed/failed operations on non-transactional NoSQL stores and much more. The first 4.2 Alpha will be out soon.
</p>
<p class="wikiPara">
Finally, some useful links:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/jira/secure/ReleaseNote.jspa?projectId=10160&amp;version=18754" target="" class="regularLink">Change log</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">User forum</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/browse/OGM" target="" class="regularLink">Issue tracker</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://lists.jboss.org/pipermail/hibernate-dev/" target="" class="regularLink">Mailing list</a>
</li>
</ul>
</div>
http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort/Hibernate Validator 5.2.0.Beta1 - a joint effort!2015-02-24T00:00:00Z2015-02-24T00:00:00ZHardy Ferentschik
We are happy to announce the release of Hibernate Validator 5.2.0.Beta1. This time a whole bunch
of Hibernate team members (Davide,
Emmanuel, Gunnar,
Sanne and myself)
joined forces to make this release happen. Thanks everyone!
In total we were able to resolve 30 issues. Here are some highlights.
Ability to provide external ClassLoader
There are several cases in which Hibernate Validator needs to load resources or classes:
XML descriptors (META-INF/validation.xml as well as XML constraint mappings)
Classes specified by name in XML descriptors
ValidationMessages resource bundle
By default Hibernate Validator tries to load these resources via the current thread context
classloader. If that’s not successful, Hibernate Validator’s own class loader will used...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
We are happy to announce the release of Hibernate Validator 5.2.0.Beta1. This time a whole bunch
of Hibernate team members (<a href="http://in.relation.to/Bloggers/Davide" target="" class="regularLink">Davide</a>,
<a href="http://in.relation.to/Bloggers/Emmanuel" target="" class="regularLink">Emmanuel</a>, <a href="http://in.relation.to/Bloggers/Gunnar" target="" class="regularLink">Gunnar</a>,
<a href="http://in.relation.to/Bloggers/Sanne" target="" class="regularLink">Sanne</a> and <a href="http://in.relation.to/Bloggers/Hardy" target="" class="regularLink">myself</a>)
joined forces to make this release happen. Thanks everyone!
</p>
<p class="wikiPara">
In total we were able to resolve <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10060&amp;version=18350" target="" class="regularLink">30</a> issues. Here are some highlights.
</p>
<h2 class="wikiHeadline2" id="H-AbilityToProvideExternalClassLoader"><a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort#H-AbilityToProvideExternalClassLoader">Ability to provide external ClassLoader</a></h2>
<p class="wikiPara">
There are several cases in which Hibernate Validator needs to load resources or classes:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem">XML descriptors (<tt>META-INF/validation.xml</tt> as well as XML constraint mappings)</li>
<li class="wikiUnorderedListItem">Classes specified by name in XML descriptors</li>
<li class="wikiUnorderedListItem">
<tt>ValidationMessages</tt> resource bundle</li>
</ul>
<p class="wikiPara">
By default Hibernate Validator tries to load these resources via the current thread context
classloader. If that’s not successful, Hibernate Validator’s own class loader will used as a
fall-back. For cases where this strategy is not appropriate (e.g. modularized environments such as OSGi), you can now provide an external class loader during bootstrapping:
</p>
<pre class="wikiPreformatted brush: java; gutter: true;">Validator validator = Validation.byProvider( HibernateValidator.class )
.configure()
.externalClassLoader( classLoader )
.buildValidatorFactory()
.getValidator();</pre>
<h2 class="wikiHeadline2" id="H-HibernateValidatorFeaturesxmlForApacheKaraf"><a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort#H-HibernateValidatorFeaturesxmlForApacheKaraf">Hibernate Validator features.xml for Apache Karaf</a></h2>
<p class="wikiPara">
As a side effect of the class loader improvements we were able to write some OSGi integration tests
between <a href="http://karaf.apache.org/" target="" class="regularLink">Apache Karaf</a> and Hibernate Valdiator. The tests themselves are
not so important, but we decided to release the required Karaf <tt>features.xml</tt> file as part of our regular
build artifacts.
You can view the first version of this file <a href="https://repository.jboss.org/nexus/service/local/repositories/releases/content/org/hibernate/hibernate-validator-osgi-karaf-features/5.2.0.Beta1/hibernate-validator-osgi-karaf-features-5.2.0.Beta1-features.xml" target="" class="regularLink">here</a>.
</p>
<h2 class="wikiHeadline2" id="H-ProgrammaticConstraintMappingViaConstraintMappingContributor"><a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort#H-ProgrammaticConstraintMappingViaConstraintMappingContributor">Programmatic constraint mapping via ConstraintMappingContributor</a></h2>
<p class="wikiPara">
In Hibernate Validator you can, as a provider specific feature, <a href="https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html_single/#section-programmatic-api" target="" class="regularLink">programmatically define constraint mappings</a>. So far this feature was tied to a programmatic bootstrapping of the <tt>ValidatorFactory</tt> itself.
However, often you are not bootstrapping the factory yourself, but work with the default factory as
configured via <tt>META-INF/validation.xml</tt>. In these cases you can now add one or more programmatic
constraint mappings by implementing a <tt>ConstraintMappingContributor</tt>:
</p>
<pre class="wikiPreformatted brush: java; gutter: true;">public static class MyConstraintMappingContributor implements ConstraintMappingContributor {
@Override
public void createConstraintMappings(ConstraintMappingBuilder builder) {
builder.addConstraintMapping()
.type( Marathon.class )
.property( "name", METHOD )
.constraint( new NotNullDef() )
.property( "numberOfHelpers", FIELD )
.constraint( new MinDef().value( 1 ) );
builder.addConstraintMapping()
.type( Runner.class )
.property( "paidEntryFee", FIELD )
.constraint( new AssertTrueDef() );
}
}</pre>
<p class="wikiPara">
In order for this <tt>ConstraintMappingContributor</tt> to get picked up by the bootstrap process,
you then need to specify the fully-qualified class name of the contributor implementation in
<tt>META-INF/validation.xml</tt>, using the property key <tt>hibernate.validator.constraint_mapping_contributor</tt>.
</p>
<h2 class="wikiHeadline2" id="H-ConstraintDefinitionContributorWithResourceBundles"><a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort#H-ConstraintDefinitionContributorWithResourceBundles">ConstraintDefinitionContributor with resource bundles</a></h2>
<p class="wikiPara">
We introduced <tt>ConstraintDefinitionContributor</tt> already in the <a href="http://in.relation.to/34906.lace" target="" class="regularLink">Alpha1</a>
release, but it so far only allowed
you to contribute constraints. Default messages via a resource bundle were not covered. This has
changed, and you can just place a <tt>ContributorValidationMessages.properties</tt> and/or its locale-specific specializations at the root your JAR. Hibernate Validator will aggregate the entries from all the bundles with this name found on the classpath.
</p>
<h2 class="wikiHeadline2" id="H-WhereDoIGetIt"><a href="http://in.relation.to/2015/02/24/hibernate-validator-520-beta-1-a-joint-effort#H-WhereDoIGetIt">Where do I get it?</a></h2>
<p class="wikiPara">
Maven artifacts for this release are in the JBoss Maven repository
(GAV <a href="https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.hibernate~hibernate-validator~5.2.0.Beta1~" target="" class="regularLink">org.hibernate:hibernate-validator:5.2.0.Beta1</a>) and on <a href="https://sourceforge.net/projects/hibernate/files/hibernate-validator/5.2.0.Beta1" target="" class="regularLink">SourceForge</a>.
</p>
<p class="wikiPara">
Feedback and questions are welcome via the Hibernate Validator
<a href="https://forum.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forum</a> or on stackoverflow using the
hibernate-validator <a href="http://stackoverflow.com/questions/tagged/hibernate-validator" target="" class="regularLink">tag</a>. If that is
not enough, check out the other ways you can get in <a href="http://hibernate.org/community" target="" class="regularLink">contact</a> with us.
</p>
<p class="wikiPara">
Enjoy!
</p>
</div>
http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data/NoSQL for Hibernate OGM: Querying for your data2015-02-23T00:00:00Z2015-02-23T00:00:00ZDavide D'Alto
Welcome to the second part of the NoSQL with Hibernate OGM 101 tutorial series.
In part 1 you have seen how to include Hibernate OGM in your Java project
and how simple it is to persist entities and switch between different kind of NoSQL datastores.
Now that your datastore contains some data you will probably want to run
some queries on it. Fear not, Hibernate OGM will let you get your data in several different ways:
using the Java Persistence Query Langage (JP-QL)
using the NoSQL native query language of the datastore of your choice (if it has one)
using Hibernate Search queries -...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Welcome to the second part of the <q>NoSQL with Hibernate OGM 101</q> tutorial series.
In <a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities" target="" class="regularLink">part 1</a> you have seen how to include Hibernate OGM in your Java project
and how simple it is to persist entities and switch between different kind of NoSQL datastores.
</p>
<p class="wikiPara">
Now that your datastore contains some data you will probably want to run
some queries on it. Fear not, Hibernate OGM will let you get your data in several different ways:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> using the Java Persistence Query Langage (JP-QL)</li>
<li class="wikiUnorderedListItem"> using the NoSQL native query language of the datastore of your choice (if it has one)</li>
<li class="wikiUnorderedListItem"> using Hibernate Search queries - primarly full-text queries</li>
</ul>
<p class="wikiPara">
All of these alternatives will allow you to run a query on the datastore
and get the result as a list of managed entities.
</p>
<h3 class="wikiHeadline3" id="H-PreparingTheTestClass"><a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data#H-PreparingTheTestClass">Preparing the test class</a></h3>
<p class="wikiPara">
We are going to add a new class HikeQueryTest. It will populate the datastore with some information about hikes:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">public class HikeQueryTest {
private static EntityManagerFactory entityManagerFactory;
@BeforeClass
public static void setUpEntityManagerFactoryAndPopulateTheDatastore() {
entityManagerFactory = Persistence.createEntityManagerFactory( "hikePu" );
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
// create a Person
Person bob = new Person( "Bob", "McRobb" );
// and two hikes
Hike cornwall = new Hike(
"Visiting Land's End", new Date(), new BigDecimal( "5.5" ),
new HikeSection( "Penzance", "Mousehole" ),
new HikeSection( "Mousehole", "St. Levan" ),
new HikeSection( "St. Levan", "Land's End" )
);
Hike isleOfWight = new Hike(
"Exploring Carisbrooke Castle", new Date(), new BigDecimal( "7.5" ),
new HikeSection( "Freshwater", "Calbourne" ),
new HikeSection( "Calbourne", "Carisbrooke Castle" )
);
// let Bob organize the two hikes
cornwall.setOrganizer( bob );
bob.getOrganizedHikes().add( cornwall );
isleOfWight.setOrganizer( bob );
bob.getOrganizedHikes().add( isleOfWight );
// persist organizer (will be cascaded to hikes)
entityManager.persist( bob );
entityManager.getTransaction().commit();
entityManager.close();
}
@AfterClass
public static void closeEntityManagerFactory() {
entityManagerFactory.close();
}
}</pre>
<p class="wikiPara">
This methods will make sure that the entity manager factory is created before running the tests and that the datastore contains some data. The data are the same we stored in <a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities" target="" class="regularLink">part 1</a>.
</p>
<p class="wikiPara">
Now that we have some data in place, we can start to write some tests to search for them.
</p>
<h3 class="wikiHeadline3" id="H-UsingTheJavaPersistenceQueryLangageJPQL"><a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data#H-UsingTheJavaPersistenceQueryLangageJPQL">Using the Java Persistence Query Langage (JP-QL)</a></h3>
<p class="wikiPara">
The JP-QL is a query language defined as part of the <a href="http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-eval-oth-JSpec/" target="" class="regularLink">Java Persistence API (JPA) specification</a>.
It's designed to work with entities and to be database independent.
</p>
<p class="wikiPara">
Taking the entity <i class="wikiEmphasis">Hike</i> as an example:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
public class Hike {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String description;
private Date date;
private BigDecimal difficulty;
@ManyToOne
private Person organizer;
@ElementCollection
@OrderColumn(name = "sectionNo")
private List&lt;HikeSection&gt; sections;
// constructors, getters, setters, ...
}</pre>
<p class="wikiPara">
A JP-QL query to get the list of available hikes ordered by difficulty looks like this:
</p>
<pre class="wikiPreformatted brush: sql; gutter: false;">SELECT h FROM Hike h ORDER BY h.difficulty ASC</pre>
<p class="wikiPara">
Hibernate OGM will parse this query and transform it into the equivalent one in the native query language of the datastore of your choice.
In Neo4j, for example, it creates and execute a Cypher query like the following:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">MATCH (h:Hike) RETURN h ORDER BY h.difficulty</pre>
<p class="wikiPara">
In MongoDB, using the MongoDB JavaScript API as a query notation, it looks like this:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">db.Hike.find({}, { "difficulty": 1})</pre>
<p class="wikiPara">
If you use JP-QL in your application you will be able to switch between datastore without the need to update the queries.
</p>
<p class="wikiPara">
Now that you have an understanding of what’s going on, we can start querying for the data we
persisted. We can, for example, get the list of available hikes:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Test
public void canSearchUsingJPQLQuery() {
// Get a new entityManager
EntityManager entityManager = entityManagerFactory.createEntityManager();
// Start transaction
entityManager.getTransaction().begin();
// Find all the available hikes ordered by difficulty
List&lt;Hike&gt; hikes = entityManager
.createQuery( "SELECT h FROM Hike h ORDER BY h.difficulty ASC" , Hike.class )
.getResultList();
assertThat( hikes.size() ).isEqualTo( 2 );
assertThat( hikes ).onProperty( "description" ).containsExactly( "Visiting Land's End", "Exploring Carisbrooke Castle" );
entityManager.getTransaction().commit();
entityManager.close();
}</pre>
<p class="wikiPara">
If you have used the JPA specification before you will find this code very familiar:
it's the same code you would write when working on a relational database using JPA.
</p>
<p class="wikiPara">
You can test this by switching the configuration and dependency between Neo4j and MongoDB: the test will still pass without any change in the code.
</p>
<p class="wikiPara">
The cool thing is that you can use JP-QL queries with datastores which don't have their own query engine. Hibernate OGM's query parser will create full-text queries in this case which are executed via Hibernate Search and Lucene. We will see later how you can do this in more details.
</p>
<p class="wikiPara">
The result of the query is a list of managed entities. This means that changes to the objects will be applied to the data in the database automatically. You also can navigate the resulting object graph, causing lazy associations to be loaded as required.
</p>
<p class="wikiPara">
The support for the JP-QL language is not complete and it might change depending on the
backend. We will leave the details to the official Hibernate OGM documentation.
At the moment what's supported is:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> simple comparisons</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">IS NULL</i> and <i class="wikiEmphasis">IS NOT NULL</i>
</li>
<li class="wikiUnorderedListItem"> the boolean operators <i class="wikiEmphasis">AND</i>, <i class="wikiEmphasis">OR</i>, <i class="wikiEmphasis">NOT</i>
</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">LIKE</i>, <i class="wikiEmphasis">IN</i> and <i class="wikiEmphasis">BETWEEN</i>
</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">ORDER BY</i>
</li>
</ul>
<p class="wikiPara">
In case JP-QL is not a good fit for your use case, we will see how you can execute
a query using the native language of the backend of your choice.
</p>
<h3 class="wikiHeadline3" id="H-UsingTheNativeBackendQueryLanguage"><a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data#H-UsingTheNativeBackendQueryLanguage">Using the native backend query language</a></h3>
<p class="wikiPara">
Sometimes you might decide to sacrifice portablility in favor of the power of the underlying native query language. For example, you might want to benefit from the abilities of Neo4j's Cypher language for running hierarchical/recursive queries.
Using MongoDB, let’s get the hikes passing through “Penzance”:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">// Search for the hikes with a section that start from "Penzace" in MongoDB
List&lt;Hike&gt; hikes = entityManager.createNativeQuery("{ $query : { sections : { $elemMatch : { start: 'Penzance' } } } }", Hike.class ).getResultList();</pre>
<p class="wikiPara">
The same code with Neo4j would look like this:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">// Search for the hikes with a section that start from "Penzace" in Neo4j
List&lt;Hike&gt; hikes = entityManager.createNativeQuery( "MATCH (h:Hike) -- (:Hike_sections {start: 'Penzance'} ) RETURN h",
Hike.class ).getResultList();</pre>
<p class="wikiPara">
The important thing to notice is that, like JPA queries, the objects returned by the query are managed entities.
</p>
<p class="wikiPara">
You can also define queries using the annotation javax.persistence.NamedNativeQuery:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
@NamedNativeQuery(
name = "PenzanceHikes",
query = "{ $query : { sections : { $elemMatch : { start: 'Penzance' } } } }", resultClass = Hike.class )
public class Hike { … }</pre>
<p class="wikiPara">
and then execute it like this:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">List&lt;Hike&gt; hikes = entityManager.createNamedQuery( "PenzanceHikes" ).getResultList();</pre>
<h3 class="wikiHeadline3" id="H-UsingHibernateSearchQueries"><a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data#H-UsingHibernateSearchQueries">Using Hibernate Search queries</a></h3>
<p class="wikiPara">
Hibernate Search offers a way to index Java objects into Lucene indexes and to execute full-text queries on them. The indexes do live outside your datastore. This means you can have query capabilities even if they are not supported natively. It also offers a few interesting properties in terms of feature set and scalability. In particular, using Hibernate Search, you can off-load query execution to separate nodes and scale it independently from the actual datastore nodes.
</p>
<p class="wikiPara">
For this example we are going to use MongoDB. You first need to add Hibernate Search to your application. In a Maven project, you need to add the following dependency in the pom.xml:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">&lt;dependencies&gt;
...
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-search-orm&lt;/artifactId&gt;
&lt;/dependency&gt;
...
&lt;/dependencies&gt;</pre>
<p class="wikiPara">
Now, you can select what you want to index:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
@Indexed
public class Hike {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
@Field
private String description;
private Date date;
private BigDecimal difficulty;
@ManyToOne
private Person organizer;
@ElementCollection
@OrderColumn(name = "sectionNo")
private List&lt;HikeSection&gt; sections;
// constructors, getters, setters, ...
}</pre>
<p class="wikiPara">
The @Indexed annotation identifies the classes that we want to index, while the @Field annotation specifies which properties of the class we want to index.
Every time a new Hike entity is persisted via the entity manager using Hibernate OGM, Hibernate Search will automatically add it to the index and keep track of changes to managed entities.
That way, index and datastore are up to date.
</p>
<p class="wikiPara">
You can now look for the hikes to Carisbrooke using Lucene queries. In this example,
we will use the query builder provided by Hibernate Search:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Test
public void canSearchUsingFullTextQuery() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
//Add full-text superpowers to any EntityManager:
FullTextEntityManager ftem = Search.getFullTextEntityManager(entityManager);
// Optionally use the QueryBuilder to simplify Query definition:
QueryBuilder b = ftem.getSearchFactory().buildQueryBuilder().forEntity( Hike.class ).get();
// A Lucene query to search for hikes to the Carisbrooke castle:
Query lq = b.keyword().onField("description").matching("Carisbrooke castle").createQuery();
//Transform the Lucene Query in a JPA Query:
FullTextQuery ftQuery = ftem.createFullTextQuery(lq, Hike.class);
//This is a requirement when using Hibernate OGM instead of ORM:
ftQuery.initializeObjectsWith( ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID );
// List matching hikes
List&lt;Hike&gt; hikes = ftQuery.getResultList();
assertThat( hikes ).onProperty( "description" ).containsOnly( "Exploring Carisbrooke Castle" );
entityManager.getTransaction().commit();
entityManager.close();
}</pre>
<p class="wikiPara">
The result of the code will be a list of hikes mentioning “Carisbrooke castle” in the description.
</p>
<p class="wikiPara">
Hibernate Search is a very powerful tool with many different options, it would take too long to describe all of them in this tutorial. You can check the <a href="http://hibernate.org/search/documentation/" target="" class="regularLink">reference documentation</a> to learn more about it.
</p>
<h3 class="wikiHeadline3" id="H-WrapUp"><a href="http://in.relation.to/2015/02/23/no-sql-for-hibernate-ogm-querying-for-your-data#H-WrapUp">Wrap up</a></h3>
<p class="wikiPara">
That’s all for now.
</p>
<p class="wikiPara">
As you have seen, Hibernate OGM provides you with a range of options to run queries against your datastore, which should cover most of your typical query needs: JP-QL, native NoSQL queries and full-text queries via Hibernate Search / Apache Lucene. Even if you have never worked with NoSQL datastores before, you will be able to experiment with them easily.
</p>
<p class="wikiPara">
You can find the <a href="https://github.com/hibernate/hibernate-demos/tree/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-2" target="" class="regularLink">complete example code</a> of this blog post (and the previous one) on GitHub. Just fork it and play with it as you like.
</p>
<p class="wikiPara">
Now that you know how to store and find your entities, we will see in the next part of the series how you can put everything inside an application container like <a href="http://wildfly.org" target="" class="regularLink">WildFly</a>.
</p>
<p class="wikiPara">
We are eager to know your opinion, feel free to comment or <a href="http://hibernate.org/community/" target="" class="regularLink">contact us</a>, we will answer your questions and hear your feed-back.;</p>
</div>
http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities/NoSQL with Hibernate OGM 101: Persisting your first entities2015-01-19T00:00:00Z2015-01-19T00:00:00ZGunnar Morling
The first final version of Hibernate OGM is out and we’ve recovered a bit from the release frenzy. So we thought it’d be a good idea to begin the new year with a tutorial-style blog series, which shows how to get started with Hibernate OGM and what it can do for you. Just in case you missed the news, Hibernate OGM is the newest project under the Hibernate umbrella and allows you to persist entity models in different NoSQL stores via the well-known JPA.
We’ll cover these topics in the following weeks:
Persisting your first entities (this instalment)
Querying for your...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
The <a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final" target="" class="regularLink">first final version of Hibernate OGM is out</a> and we’ve recovered a bit from the release frenzy. So we thought it’d be a good idea to begin the new year with a tutorial-style blog series, which shows how to get started with Hibernate OGM and what it can do for you. Just in case you missed the news, <a href="http://hibernate.org/ogm/" target="" class="regularLink">Hibernate OGM</a> is the newest project under the Hibernate umbrella and allows you to persist entity models in different NoSQL stores via the well-known <a href="http://en.wikipedia.org/wiki/Java_Persistence_API" target="" class="regularLink">JPA</a>.
</p>
<p class="wikiPara">
We’ll cover these topics in the following weeks:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Persisting your first entities (this instalment)</li>
<li class="wikiUnorderedListItem"> Querying for your data</li>
<li class="wikiUnorderedListItem"> Running on WildFly</li>
<li class="wikiUnorderedListItem"> Running with CDI on Java SE</li>
<li class="wikiUnorderedListItem"> Store data into two different stores in the same application</li>
</ul>
<p class="wikiPara">
If you’d like us to discuss any other topics, please let us know. Just add a comment below or <a href="https://twitter.com/Hibernate" target="" class="regularLink">tweet your suggestions</a> to us.
</p>
<p class="wikiPara">
In this first part of the series we are going to set up a Java project with the required dependencies, create some simple entities and write/read them to and from the store. We’ll start with the <a href="http://neo4j.com/" target="" class="regularLink">Neo4j graph database</a> and then we’ll switch to the <a href="http://mongodb.org/" target="" class="regularLink">MongoDB document store</a> with only a small configuration change.
</p>
<h3 class="wikiHeadline3" id="H-ProjectSetup"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-ProjectSetup">Project set-up</a></h3>
<p class="wikiPara">
Let’s first create a new Java project with the required dependencies. We’re going to use Maven as a build tool in the following, but of course Gradle or others would work equally well.
</p>
<p class="wikiPara">
Add this to the <tt>dependencyManagement</tt> block of your pom.xml:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
...
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-bom&lt;/artifactId&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;version&gt;4.1.1.Final&lt;/version&gt;
&lt;scope&gt;import&lt;/scope&gt;
&lt;/dependency&gt;
...
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
...</pre>
<p class="wikiPara">
This will make sure that you are using matching versions of the Hibernate OGM modules and their dependencies. Then add the following to the <tt>dependencies</tt> block:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;dependencies&gt;
...
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-neo4j&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.jboss.jbossts&lt;/groupId&gt;
&lt;artifactId&gt;jbossjta&lt;/artifactId&gt;
&lt;/dependency&gt;
...
&lt;/dependencies&gt;
...</pre>
<p class="wikiPara">
The dependencies are:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> The Hibernate OGM module for working with an embedded Neo4j database; This will pull in all other required modules such as Hibernate OGM core and the Neo4j driver. When using MongoDB, you’d swap that with <i class="wikiEmphasis">hibernate-ogm-mongodb</i>.</li>
<li class="wikiUnorderedListItem"> JBoss' implementation of the Java Transaction API (JTA), which is needed when not running within a Java EE container such as WildFly</li>
</ul>
<h3 class="wikiHeadline3" id="H-TheDomainModel"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-TheDomainModel">The domain model</a></h3>
<p class="wikiPara">
Our example domain model is made up of three classes: <tt>Hike</tt>, <tt>HikeSection</tt> and <tt>Person</tt>.
</p>
<div align="center"><img src="http://yuml.me/027c5fc5"></div>
<p class="wikiPara">
There is a composition relationship between <tt>Hike</tt> and <tt>HikeSection</tt>, i.e. a hike comprises several sections whose life cycle is fully dependent on the Hike. The list of hike sections is ordered; This order needs to be maintained when persisting a hike and its sections.
</p>
<p class="wikiPara">
The association between <tt>Hike</tt> and <tt>Person</tt> (acting as hike organizer) is a bi-directional many-to-one/one-to-many relationship: One person can organize zero ore more hikes, whereas one hike has exactly one person acting as its organizer.
</p>
<h3 class="wikiHeadline3" id="H-MappingTheEntities"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-MappingTheEntities">Mapping the entities</a></h3>
<p class="wikiPara">
Now let’s map the domain model by creating the entity classes and annotating them with the required meta-data. Let’s start with the <tt>Person</tt> class:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
public class Person {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private long id;
private String firstName;
private String lastName;
@OneToMany(mappedBy = "organizer", cascade = CascadeType.PERSIST)
private Set&lt;Hike&gt; organizedHikes = new HashSet&lt;&gt;();
// constructors, getters and setters...
}</pre>
<p class="wikiPara">
The entity type is marked as such using the <tt>@Entity</tt> annotation, while the property representing the identifier is annotated with <tt>@Id</tt>.
</p>
<p class="wikiPara">
Instead of assigning ids manually, Hibernate OGM can take care of this, offering several id generation strategies such as (emulated) sequences, UUIDs and more. Using a UUID generator is usually a good choice as it ensures portability across different NoSQL datastores and makes id generation fast and scalable. But depending on the store you work with, you also could use specific id types such as object ids in the case of MongoDB (see the <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/#_entities_3" target="" class="regularLink">reference guide</a> for the details).
</p>
<p class="wikiPara">
Finally, <tt>@OneToMany</tt> marks the <tt>organizedHikes</tt> property as an association between entities. As it is a bi-directional entity, the <tt>mappedBy</tt> attribute is required for specifying the side of the association which is in charge of managing it. Specifying the cascade type <tt>PERSIST</tt> ensures that persisting a person will automatically cause its associated hikes to be persisted, too.
</p>
<p class="wikiPara">
Next is the <tt>Hike</tt> class:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
public class Hike {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
private String description;
private Date date;
private BigDecimal difficulty;
@ManyToOne
private Person organizer;
@ElementCollection
@OrderColumn(name = "sectionNo")
private List&lt;HikeSection&gt; sections;
// constructors, getters and setters...
}</pre>
<p class="wikiPara">
Here the <tt>@ManyToOne</tt> annotation marks the other side of the bi-directional association between <tt>Hike</tt> and <tt>Organizer</tt>. As <tt>HikeSection</tt> is supposed to be dependent on Hike, the sections list is mapped via <tt>@ElementCollection</tt>. To ensure the order of sections is maintained in the datastore, <tt>@OrderColumn</tt> is used. This will add one extra "column" to the persisted records which holds the order number of each section.
</p>
<p class="wikiPara">
Finally, the <tt>HikeSection</tt> class:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Embeddable
public class HikeSection {
private String start;
private String end;
// constructors, getters and setters...
}</pre>
<p class="wikiPara">
Unlike <tt>Person</tt> and <tt>Hike</tt>, it is not mapped via <tt>@Entity</tt> but using <tt>@Embeddable</tt>. This means it is always part of another entity (<tt>Hike</tt> in this case) and as such also has no identity on its own. Therefore it doesn’t declare any <tt>@Id</tt> property.
</p>
<p class="wikiPara">
Note that these mappings looked exactly the same, had you been using Hibernate ORM with a relational datastore. And indeed that’s one of the promises of Hibernate OGM: Make the migration between the relational and the NoSQL paradigms as easy as possible!
</p>
<h3 class="wikiHeadline3" id="H-CreatingThePersistencexml"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-CreatingThePersistencexml">Creating the persistence.xml</a></h3>
<p class="wikiPara">
With the entity classes in place, one more thing is missing, JPA's persistence.xml descriptor. Create it under <i class="wikiEmphasis">src/main/resources/META-INF/persistence.xml</i>:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0"&gt;
&lt;persistence-unit name="hikePu" transaction-type="RESOURCE_LOCAL"&gt;
&lt;provider&gt;org.hibernate.ogm.jpa.HibernateOgmPersistence&lt;/provider&gt;
&lt;properties&gt;
&lt;property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" /&gt;
&lt;property name="hibernate.ogm.datastore.database" value="HikeDB" /&gt;
&lt;property name="hibernate.ogm.neo4j.database_path" value="target/test_data_dir" /&gt;
&lt;/properties&gt;
&lt;/persistence-unit&gt;
&lt;/persistence&gt;</pre>
<p class="wikiPara">
If you have worked with JPA before, this persistence unit definition should look very familiar to you. The main difference to using the classic Hibernate ORM on top of a relational database is the specific provider class we need to specify for Hibernate OGM: <tt>org.hibernate.ogm.jpa.HibernateOgmPersistence</tt>.
</p>
<p class="wikiPara">
In addition, some properties specific to Hibernate OGM and the chosen back end are defined to set:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> the back end to use (an embedded Neo4j graph database in this case)</li>
<li class="wikiUnorderedListItem"> the name of the Neo4j database</li>
<li class="wikiUnorderedListItem"> the directory for storing the Neo4j database files</li>
</ul>
<p class="wikiPara">
Depending on your usage and the back end, other properties might be required, e.g. for setting a host, user name, password etc. You can find all available properties in a class named <tt>&lt;BACK END&gt;Properties</tt>, e.g. <a href="https://docs.jboss.org/hibernate/ogm/4.1/api/index.html?org/hibernate/ogm/datastore/neo4j/Neo4jProperties.html" target="" class="regularLink">Neo4jProperties</a>, <a href="https://docs.jboss.org/hibernate/ogm/4.1/api/index.html?org/hibernate/ogm/datastore/mongodb/MongoDBProperties.html" target="" class="regularLink">MongoDBProperties</a> and so on.
</p>
<h3 class="wikiHeadline3" id="H-SavingAndLoadingAnEntity"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-SavingAndLoadingAnEntity">Saving and loading an entity</a></h3>
<p class="wikiPara">
With all these bits in place its time to persist (and load) some entities. Create a simple JUnit test shell for doing so:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">public class HikeTest {
private static EntityManagerFactory entityManagerFactory;
@BeforeClass
public static void setUpEntityManagerFactory() {
entityManagerFactory = Persistence.createEntityManagerFactory( "hikePu" );
}
@AfterClass
public static void closeEntityManagerFactory() {
entityManagerFactory.close();
}
}</pre>
<p class="wikiPara">
The two methods manage an entity manager factory for the persistence unit defined in persistence.xml. It is kept in a field so it can be used for several test methods (remember, entity manager factories are rather expensive to create, so they should be initialized once and be kept around for re-use).
</p>
<p class="wikiPara">
Then create a test method persisting and loading some data:
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Test
public void canPersistAndLoadPersonAndHikes() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
// create a Person
Person bob = new Person( "Bob", "McRobb" );
// and two hikes
Hike cornwall = new Hike(
"Visiting Land's End", new Date(), new BigDecimal( "5.5" ),
new HikeSection( "Penzance", "Mousehole" ),
new HikeSection( "Mousehole", "St. Levan" ),
new HikeSection( "St. Levan", "Land's End" )
);
Hike isleOfWight = new Hike(
"Exploring Carisbrooke Castle", new Date(), new BigDecimal( "7.5" ),
new HikeSection( "Freshwater", "Calbourne" ),
new HikeSection( "Calbourne", "Carisbrooke Castle" )
);
// let Bob organize the two hikes
cornwall.setOrganizer( bob );
bob.getOrganizedHikes().add( cornwall );
isleOfWight.setOrganizer( bob );
bob.getOrganizedHikes().add( isleOfWight );
// persist organizer (will be cascaded to hikes)
entityManager.persist( bob );
entityManager.getTransaction().commit();
// get a new EM to make sure data is actually retrieved from the store and not Hibernate's internal cache
entityManager.close();
entityManager = entityManagerFactory.createEntityManager();
// load it back
entityManager.getTransaction().begin();
Person loadedPerson = entityManager.find( Person.class, bob.getId() );
assertThat( loadedPerson ).isNotNull();
assertThat( loadedPerson.getFirstName() ).isEqualTo( "Bob" );
assertThat( loadedPerson.getOrganizedHikes() ).onProperty( "description" ).containsOnly( "Visiting Land's End", "Exploring Carisbrooke Castle" );
entityManager.getTransaction().commit();
entityManager.close();
}</pre>
<p class="wikiPara">
Note how both actions happen within a transaction. Neo4j is a fully transactional datastore which can be controlled nicely via JPA’s transaction API. Within an actual application one would probably work with a less verbose approach for transaction control. Depending on the chosen back end and the kind of environment your application runs in (e.g. a Java EE container such as <a href="http://wildfly.org/" target="" class="regularLink">WildFly</a>), you could take advantage of declarative transaction management via CDI or EJB. But let’s save that for another time.
</p>
<p class="wikiPara">
Having persisted some data, you can examine it, using the nice <a href="http://neo4j.com/docs/stable/tools-webadmin.html" target="" class="regularLink">web console</a> coming with Neo4j. The following shows the entities persisted by the test:
</p>
<div align="center"><img src="http://i.imgur.com/aDXbhi6.png"></div>
<p class="wikiPara">
Hibernate OGM aims for the most natural mapping possible for the datastore you are targeting. In the case of Neo4j as a graph datastore this means that any entity will be mapped to a corresponding node.
</p>
<p class="wikiPara">
The entity properties are mapped as node properties (see the black box describing one of the Hike nodes). Any not natively supported property types will be converted as required. E.g. that’s the case for the <tt>date</tt> property which is persisted as an ISO-formatted String. Additionally, each entity node has the <a href="http://neo4j.com/docs/stable/graphdb-neo4j-labels.html" target="" class="regularLink">label</a> ENTITY (to distinguish it from nodes of other types) and a label specifying its entity type (Hike in this case).
</p>
<p class="wikiPara">
Associations are mapped as relationships between nodes, with the association role being mapped to the <a href="http://neo4j.com/docs/stable/graphdb-neo4j-relationships.html" target="" class="regularLink">relationship type</a>.
</p>
<p class="wikiPara">
Note that Neo4j does not have the notion of embedded objects. Therefore, the <tt>HikeSection</tt> objects are mapped as nodes with the label EMBEDDED, linked with the owning Hike nodes. The order of sections is persisted via a property on the relationship.
</p>
<h3 class="wikiHeadline3" id="H-SwitchingToMongoDB"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-SwitchingToMongoDB">Switching to MongoDB</a></h3>
<p class="wikiPara">
One of Hibernate OGM's promises is to allow using the same API - namely, JPA - to work with different NoSQL stores. So let’s see how that holds and make use of MongoDB which, unlike Neo4j, is a document datastore and persists data in a JSON-like representation. To do so, first replace the Neo4j back end with the following one:
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;dependency&gt;
&lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-ogm-mongodb&lt;/artifactId&gt;
&lt;/dependency&gt;
...</pre>
<p class="wikiPara">
Then update the configuration in persistence.xml to work with MongoDB as the back end, using the properties accessible through <tt>MongoDBProperties</tt> to give host name and credentials matching your environment (if you don’t have MongoDB installed yet, you can download it <a href="https://www.mongodb.org/downloads" target="" class="regularLink">here</a>):
</p>
<pre class="wikiPreformatted brush: xml; gutter: false;">...
&lt;properties&gt;
&lt;property name="hibernate.ogm.datastore.provider" value="mongodb" /&gt;
&lt;property name="hibernate.ogm.datastore.database" value="HikeDB" /&gt;
&lt;property name="hibernate.ogm.datastore.host" value="mongodb.mycompany.com" /&gt;
&lt;property name="hibernate.ogm.datastore.username" value="db_user" /&gt;
&lt;property name="hibernate.ogm.datastore.password" value="top_secret!" /&gt;
&lt;/properties&gt;
...</pre>
<p class="wikiPara">
And that’s all you need to do to persist your entities in MongoDB rather than Neo4j. If you now run the test again, you’ll find the following BSON documents in your datastore:
</p>
<pre class="wikiPreformatted"># Collection "Person"
{
"_id" : "50b62f9b-874f-4513-85aa-c2f59015a9d0",
"firstName" : "Bob",
"lastName" : "McRobb",
"organizedHikes" : [
"a78d731f-eff0-41f5-88d6-951f0206ee67",
"32384eb4-717a-43dc-8c58-9aa4c4e505d1"
]
}</pre>
<pre class="wikiPreformatted"># Collection Hike
{
"_id" : "a78d731f-eff0-41f5-88d6-951f0206ee67",
"date" : ISODate("2015-01-16T11:59:48.928Z"),
"description" : "Visiting Land's End",
"difficulty" : "5.5",
"organizer_id" : "50b62f9b-874f-4513-85aa-c2f59015a9d0",
"sections" : [
{
"sectionNo" : 0,
"start" : "Penzance",
"end" : "Mousehole"
},
{
"sectionNo" : 1,
"start" : "Mousehole",
"end" : "St. Levan"
},
{
"sectionNo" : 2,
"start" : "St. Levan",
"end" : "Land's End"
}
]
}
{
"_id" : "32384eb4-717a-43dc-8c58-9aa4c4e505d1",
"date" : ISODate("2015-01-16T11:59:48.928Z"),
"description" : "Exploring Carisbrooke Castle",
"difficulty" : "7.5",
"organizer_id" : "50b62f9b-874f-4513-85aa-c2f59015a9d0",
"sections" : [
{
"sectionNo" : 1,
"start" : "Calbourne",
"end" : "Carisbrooke Castle"
},
{
"sectionNo" : 0,
"start" : "Freshwater",
"end" : "Calbourne"
}
]
}</pre>
<p class="wikiPara">
Again, the mapping is very natural and just as you’d expect it when working with a document store like MongoDB. The bi-directional one-to-many/many-to-one association between <tt>Person</tt> and <tt>Hike</tt> is mapped by storing the referenced id(s) on either side. When loading back the data, Hibernate OGM will resolve the ids and allow to navigate the association from one object to the other.
</p>
<p class="wikiPara">
Element collections are mapped using MongoDB's capabilities for storing hierarchical structures. Here the sections of a hike are mapped to an array within the document of the owning hike, with an additional field <tt>sectionNo</tt> to maintain the collection order. This allows to load an entity and its embedded elements very efficiently via a single round-trip to the datastore.
</p>
<h3 class="wikiHeadline3" id="H-Wrapup"><a href="http://in.relation.to/2015/01/19/no-sql-with-hibernate-ogm-101-persisting-your-first-entities#H-Wrapup">Wrap-up</a></h3>
<p class="wikiPara">
In this first instalment of <i class="wikiEmphasis">NoSQL with Hibernate OGM 101</i> you’ve learned how to set up a project with the required dependencies, map some entities and associations and persist them in Neo4j and MongoDB.
All this happens via the well-known JPA API. So if you have worked with Hibernate ORM and JPA in the past on top of relational databases, it never was easier to dive into the world of NoSQL.
</p>
<p class="wikiPara">
At the same time, each store is geared towards certain use cases and thus provides specific features and configuration options. Naturally, those cannot be exposed through a generic API such as JPA. Therefore Hibernate OGM lets you make usage of native NoSQL queries and allows to configure store-specific settings via its flexible option system.
</p>
<p class="wikiPara">
You can find the <a href="https://github.com/hibernate/hibernate-demos/tree/master/hibernate-ogm/nosql-with-hibernate-ogm-101/hibernate-ogm-demo-nosql-with-hibernate-ogm-101-part-1" target="" class="regularLink">complete example code</a> of this blog post on GitHub. Just fork it and play with it as you like.
</p>
<p class="wikiPara">
Of course storing entities and getting them back via their id is only the beginning. In any real application you’d want to run queries against your data and you’d likely also want to take advantage of some specific features and settings of your chosen NoSQL store. We’ll come to that in the next parts of this series, so stay tuned!</p>
</div>
http://in.relation.to/2015/01/16/jboss-community-asylum-opta-planner-for-the-masses/JBoss Community Asylum - OptaPlanner for the masses2015-01-16T00:00:00Z2015-01-16T00:00:00ZMax Andersen
Its a new year and time for a new episode! Great time to talk about making plans.
In this episode we are talking with Geoffrey about his OptaPlanner project.
Find it all in the
Show notes and episode.
Have fun!
...
<div id="documentDisplay" class="documentDisplay">
<img src="http://in.relation.to/images/legacy/13429.jpeg" align="left" style="padding-right: 15px; width: 150px;">
<p class="wikiPara">
Its a new year and time for a new episode! Great time to talk about making plans.
</p>
<p class="wikiPara">
In this episode we are talking with Geoffrey about his OptaPlanner project.
</p>
<p class="wikiPara">
Find it all in the
<a href="http://jbosscommunityasylum.libsyn.com/podcast-37-optaplanner-for-the-masses" target="" class="regularLink">Show notes and episode</a>.
</p>
<p class="wikiPara">
Have fun!
</p>
</div>
http://in.relation.to/2015/01/15/more-supported-data-types-and-some-bug-fixes-hibernate-ogm-411-released/More supported data types and some bug fixes: Hibernate OGM 4.1.1 released2015-01-15T00:00:00Z2015-01-15T00:00:00ZGunnar Morling
It’s my pleasure to announce the first maintenance release of Hibernate OGM 4.1! This version makes a few more data types usable for your entity properties (float, short, char), comes with several component upgrades (Hibernate ORM 4.3.8 and Infinispan 7.0.3) and fixes some bugs.
The latter were discovered by helpful users who gave Hibernate OGM a spin after 4.1 was out in December. Kudos to everyone testing the library and reporting bugs or feature requests, that’s much appreciated!
We see an increased interest in Hibernate OGM by means of questions in the forum. Keep those coming; specifically we’re looking forward to your...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
It’s my pleasure to announce the first maintenance release of Hibernate OGM 4.1! This version makes a few more data types usable for your entity properties (float, short, char), comes with several component upgrades (Hibernate ORM 4.3.8 and Infinispan 7.0.3) and fixes some bugs.
</p>
<p class="wikiPara">
The latter were discovered by helpful users who gave Hibernate OGM a spin after <a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final" target="" class="regularLink">4.1 was out</a> in December. Kudos to everyone testing the library and reporting bugs or feature requests, that’s much appreciated!
</p>
<p class="wikiPara">
We see an increased interest in Hibernate OGM by means of questions in <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">the forum</a>. Keep those coming; specifically we’re looking forward to your feature proposals, so we know which functionality we should implement next to provide the most value for you. We are also monitoring the <a href="https://stackoverflow.com/questions/tagged/?tagnames=hibernate-ogm&amp;sort=newest" target="" class="regularLink">hibernate-ogm tag</a> on Stack Overflow. So if that’s more your kind of thing, ask your question there and we’ll come up with an answer.
</p>
<p class="wikiPara">
To give the new release a try, either download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.1.Final/" target="" class="regularLink">release bundle</a> from SourceForge or use these GAV coordinates with your preferred build tool:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-core:4.1.1.Final</i> for the Hibernate OGM engine and</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">org.hibernate.ogm:hibernate-ogm-&lt;%DATASTORE%&gt;:4.1.1.Final</i>, depending on the backend you want to use.</li>
</ul>
<p class="wikiPara">
Also let me use the opportunity to say a big Thank You to our community member <a href="https://github.com/ajaybhat" target="" class="regularLink">Ajay Bhat</a> who contributed the support for the new data types!
</p>
<p class="wikiPara">
Finally, some useful links:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10160&amp;version=18950" target="" class="regularLink">Change log</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">User forum</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://hibernate.atlassian.net/browse/OGM" target="" class="regularLink">Issue tracker</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://lists.jboss.org/pipermail/hibernate-dev/" target="" class="regularLink">Mailing list</a>
</li>
</ul>
</div>
http://in.relation.to/2015/01/12/some-more-hibernate-search-5/Some more Hibernate Search 52015-01-12T00:00:00Z2015-01-12T00:00:00ZSanne Grinovero
After the great news in December of the release of Hibernate Search 5.0.0.Final and the first stable (.Final) release of Hibernate OGM, we plan to keep updates coming regularly.
So today we introduce:
Hibernate Search 5.0.1.Final
Hibernate Search 4.5.3.Final
Both are considered stable; as expected for micro maintenance there was no need to update neither documentation nor the migration guide.
What's new in version 5.0.1.Final
updated to latest stable Hibernate ORM 4.3.8.Final
updated to latest stable Apache Lucene 4.10.3
improved some logging messages to be able to better help some users
What's new in version 4.5.3.Final
backported some backend changes like HSEARCH-1770, mostly useful...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
After the great news in December of the release of <a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final" target="" class="regularLink">Hibernate Search 5.0.0.Final</a> and the first stable (.Final) release of <a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final" target="" class="regularLink">Hibernate OGM</a>, we plan to keep updates coming regularly.
</p>
<p class="wikiPara">
So today we introduce:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">Hibernate Search 5.0.1.Final</i>
</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">Hibernate Search 4.5.3.Final</i>
</li>
</ul>
<p class="wikiPara">
Both are considered stable; as expected for micro maintenance there was no need to update neither documentation nor the migration guide.
</p>
<h2 class="wikiHeadline2" id="H-WhatsNewInVersion501Final"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-WhatsNewInVersion501Final">What's new in version 5.0.1.Final</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> updated to latest stable Hibernate ORM 4.3.8.Final</li>
<li class="wikiUnorderedListItem"> updated to latest stable Apache Lucene 4.10.3</li>
<li class="wikiUnorderedListItem"> improved some logging messages to be able to better help some users</li>
</ul>
<h2 class="wikiHeadline2" id="H-WhatsNewInVersion453Final"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-WhatsNewInVersion453Final">What's new in version 4.5.3.Final</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> backported some backend changes like <a href="https://hibernate.atlassian.net/browse/HSEARCH-1770" target="" class="regularLink">HSEARCH-1770</a>, mostly useful to third party integrators such as <a href="http://blog.infinispan.org/2015/01/infinispan-710beta1.html" target="" class="regularLink">Infinispan Query</a> to improve their indexing efficiency.</li>
</ul>
<h2 class="wikiHeadline2" id="H-WildFly9IsComing"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-WildFly9IsComing">WildFly 9 is coming</a></h2>
<p class="wikiPara">
The source code of WildFly was updated to include our latest Hibernate Search 5. Looking forward to the final release of this super popular application server, as you won't have to download the Hibernate Search 5 dependencies separately!
</p>
<h2 class="wikiHeadline2" id="H-HowToGetIt"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-HowToGetIt">How to get it</a></h2>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.0.1.Final" target="" class="regularLink">full distribution from here</a>.
And don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.
</p>
<h2 class="wikiHeadline2" id="H-Stackoverflow"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-Stackoverflow">Stackoverflow</a></h2>
<p class="wikiPara">
If you prefer to use <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">stackoverflow.com</a>, please use the tag <i class="wikiEmphasis">hibernate-search</i>.
And if you have a moment to help other users, some please consider registering to the <a href="http://stackoverflow.com/questions/tagged/hibernate-search" target="" class="regularLink">hibernate-search</a> tag to help us answering all the questions.
</p>
<p class="wikiPara">
If you are new to Hibernate Search, best is to start with our <a href="http://hibernate.org/search/documentation/getting-started/" target="" class="regularLink">getting started guide</a>. And remember: feedback, comments and/or <a href="https://github.com/hibernate/hibernate.org" target="" class="regularLink">pull-requests</a> are welcome on the website too.
</p>
<h1 class="wikiHeadline1" id="H-NextTalkJBUGLondon"><a href="http://in.relation.to/2015/01/12/some-more-hibernate-search-5#H-NextTalkJBUGLondon">Next talk: JBUG London</a></h1>
<p class="wikiPara">
Please remember I'll be talking about Hibernate Search 5 <a href="http://www.meetup.com/JBoss-User-Group/events/219038939/" target="" class="regularLink">this Wednesday the 14th of January in London</a>. There will be pizza, beers, and pub time to discuss anything related to Search.</p>
</div>
http://in.relation.to/2015/01/07/hibernate-orm-438-final-and-4217-final-released/Hibernate ORM 4.3.8.Final and 4.2.17.Final Released2015-01-07T00:00:00Z2015-01-07T00:00:00ZGail Badner
These releases contain mostly minor bugfixes and improvements. For more information, please see:
4.3.8.Final change log: https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&version=18151
4.2.17.Final change log: https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&version=18451
Most changes applied to both versions. Of note are:
A new MySQL dialect (MySQL57InnoDBDialect) that adds support for fractional seconds HHH-8401;
NamingStrategyDelegator is now supported by standalone schema tools HHH-9467.
Other fixes made to 4.3.8 (only) were minor bug fixes and improvements.
JBoss Nexus: https://repository.jboss.org/nexus/content/groups/public/org/hibernate
Maven Central: http://repo1.maven.org/maven2/org/hibernate/hibernate-core (should update in a couple of days)
SourceForge: https://sourceforge.net/projects/hibernate/files/hibernate4
4.3.8.Final Downloads: 4.3.8.Final ZIP, 4.3.8.Final TGZ
4.2.17.Final Downloads: 4.2.17.Final ZIP, 4.2.17.Final TGZ
...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
These releases contain mostly minor bugfixes and improvements. For more information, please see:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> 4.3.8.Final change log: <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&amp;version=18151" target="" class="regularLink">https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&amp;version=18151</a>
</li>
<li class="wikiUnorderedListItem"> 4.2.17.Final change log: <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&amp;version=18451" target="" class="regularLink">https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10031&amp;version=18451</a>
</li>
</ul>
<p class="wikiPara">
Most changes applied to both versions. Of note are:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> A new MySQL dialect (MySQL57InnoDBDialect) that adds support for fractional seconds <a href="https://hibernate.atlassian.net/browse/HHH-8401" target="" class="regularLink">HHH-8401</a>;</li>
<li class="wikiUnorderedListItem"> NamingStrategyDelegator is now supported by standalone schema tools <a href="https://hibernate.atlassian.net/browse/HHH-9467" target="" class="regularLink">HHH-9467</a>.</li>
</ul>
<p class="wikiPara">
Other fixes made to 4.3.8 (only) were minor bug fixes and improvements.
</p>
<p class="wikiPara">
JBoss Nexus: <a href="https://repository.jboss.org/nexus/content/groups/public/org/hibernate" target="" class="regularLink">https://repository.jboss.org/nexus/content/groups/public/org/hibernate</a><br>
Maven Central: <a href="http://repo1.maven.org/maven2/org/hibernate/hibernate-core" target="" class="regularLink">http://repo1.maven.org/maven2/org/hibernate/hibernate-core</a> (should update in a couple of days)<br>
</p>
<p class="wikiPara">
SourceForge: <a href="https://sourceforge.net/projects/hibernate/files/hibernate4" target="" class="regularLink">https://sourceforge.net/projects/hibernate/files/hibernate4</a><br>
4.3.8.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.8.Final/hibernate-release-4.3.8.Final.zip/download" target="" class="regularLink">4.3.8.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.3.8.Final/hibernate-release-4.3.8.Final.tgz/download" target="" class="regularLink">4.3.8.Final TGZ</a><br>
4.2.17.Final Downloads: <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.17.Final/hibernate-release-4.2.17.Final.zip/download" target="" class="regularLink">4.2.17.Final ZIP</a>, <a href="http://sourceforge.net/projects/hibernate/files/hibernate4/4.2.17.Final/hibernate-release-4.2.17.Final.tgz/download" target="" class="regularLink">4.2.17.Final TGZ</a>
</p>
</div>
http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final/A fresh new major release: Hibernate Search 5.0.0.Final2014-12-17T00:00:00Z2014-12-17T00:00:00ZSanne Grinovero
After 14 months of hard work, please welcome Hibernate Search 5 !
Let's have a look at the highlights of why you should be eager to upgrade:
Upgraded to Lucene 4.10
Lots of internal improvements, especially performance
Thanks to Hibernate Search abstraction, most of your code should be upgradable easily despite the massive changes in Lucene APIs
Numeric properties now indexed as NumericField by default
Requires JDK 7
Compatible with Hibernate ORM 4.3 and WildFly 8.x
Stable
How to get it
Everything you need is available on Hibernate Search's web site.
Download the full distribution from here.
And don't hesitate to reach us in our...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
After 14 months of hard work, please welcome Hibernate Search 5 !
</p>
<p class="wikiPara">
Let's have a look at the highlights of why you should be eager to upgrade:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Upgraded to Lucene 4.10</li>
<li class="wikiUnorderedListItem"> Lots of internal improvements, especially performance</li>
<li class="wikiUnorderedListItem"> Thanks to Hibernate Search abstraction, most of your code should be upgradable easily despite the massive changes in Lucene APIs</li>
<li class="wikiUnorderedListItem"> Numeric properties now indexed as <tt>NumericField</tt> by default</li>
<li class="wikiUnorderedListItem"> Requires JDK 7</li>
<li class="wikiUnorderedListItem"> Compatible with Hibernate ORM 4.3 and WildFly 8.x</li>
<li class="wikiUnorderedListItem"> Stable</li>
</ul>
<h2 class="wikiHeadline2" id="H-HowToGetIt"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-HowToGetIt">How to get it</a></h2>
<p class="wikiPara">
Everything you need is available on Hibernate Search's <a href="http://hibernate.org/search/" target="" class="regularLink">web site</a>.
Download the <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.0.0.Final" target="" class="regularLink">full distribution from here</a>.
And don't hesitate to reach us in our <a href="https://forums.hibernate.org/viewforum.php?f=9" target="" class="regularLink">forums</a>.
</p>
<p class="wikiPara">
If you are new to Hibernate Search, best is to start with our <a href="http://hibernate.org/search/documentation/getting-started/" target="" class="regularLink">getting started guide</a>.
</p>
<h2 class="wikiHeadline2" id="H-FeatureList"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-FeatureList">Feature list</a></h2>
<p class="wikiPara">
Let's dive into the feature list.
</p>
<h3 class="wikiHeadline3" id="H-Lucene410"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-Lucene410">Lucene 4.10</a></h3>
<p class="wikiPara">
Hibernate Search 4 has been stuck with the quite outdated 3.6.x version of Apache Lucene, while the Lucene 4 series is introducing lots of improvements. Lucene has now reached version 4.10.3 and is considered stable, reliable and significantly more efficient than previous versions; you can now benefit from all these improvements.
Some APIs changed, you might need to make some adjustments to your code such as Analyzer class names, but generally if you were using the Hibernate Search API, the most tricky changes of Lucene are encapsulated and won't affect your code directly.
</p>
<h3 class="wikiHeadline3" id="H-WhyQversion50q"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-WhyQversion50q">Why <q>version 5.0</q></a></h3>
<p class="wikiPara">
The major number was increased because the Lucene upgrade is a significant change, and because it forced us to break our API compatibility promise which we apply on minor versions.
Don't assume that this will require Hibernate ORM at version 5 too: it still depends on Hibernate ORM versions 4.3.x (as did Hibernate Search 4.5) and is still compatible with WildFly 8, and we expect it will be compatible with WildFly 9 as well.
It is possible that Hibernate Search 5 will be compatible with ORM version 5; we'll certainly aim for that, but cannot guarantee it.
</p>
<p class="wikiPara">
So if you have an application using Hibernate ORM 4.3.x and Hibernate Search 4.5.x, it should be simple to upgrade as you won't have to upgrade ORM and can focus on changes needed for Search and Lucene only.
</p>
<h3 class="wikiHeadline3" id="H-IndexingPerformance"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-IndexingPerformance">Indexing Performance</a></h3>
<p class="wikiPara">
The indexing engine has been revisited, providing great performance enhancements and also simplifying configuration: you no longer need to configure a number of backend workers.
</p>
<p class="wikiPara">
Both asynchronous indexing and synchronous indexing have been redesigned.
</p>
<p class="wikiPara">
For the asynchronous indexing backend you now have a per-index <i class="wikiEmphasis">index_flush_interval</i> property which you can use to limit the time between your updates committed on the database and the related index commit.
</p>
<p class="wikiPara">
The synchronous backend is now able to merge write requests from multiple parallel transactions so to provide both the benefits of batched writes on the index while still having synchronous updates.
This new model allows to have performance similar to what was previously only possible when selecting the NRT backend, but doesn't have the drawbacks such as not being compatible with the Infinispan Directory.
</p>
<h3 class="wikiHeadline3" id="H-OSGiApacheKarafJBossFUSE"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-OSGiApacheKarafJBossFUSE">OSGi, Apache Karaf, JBoss FUSE</a></h3>
<p class="wikiPara">
The project code and build has been refactored to produce nice OSGi compatible libraries. We run integration tests with Apache Karaf so our artefacts should be safe to consume via JBoss FUSE. The Lucene jars are still a bit troublesome, but if you have any problem with it please let us know we might be able to find a solution.
</p>
<h3 class="wikiHeadline3" id="H-JDK78And9Compatibility"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-JDK78And9Compatibility">JDK 7, 8 and 9 compatibility</a></h3>
<p class="wikiPara">
Hibernate Search 5 now requires a Java 7 runtime, but we also test regularly with Java 8 and previews of Java 9.
</p>
<h3 class="wikiHeadline3" id="H-AutomaticBridgeDiscoveryForPropertyConversion"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-AutomaticBridgeDiscoveryForPropertyConversion">Automatic bridge discovery for property conversion</a></h3>
<p class="wikiPara">
For those developers defining custom domain types, it's now possible to automatically bind a given Java type to a FieldBridge. You won't have to copy/paste those @FieldBridge annotations all over your model.
This feature is explained in <a href="http://docs.jboss.org/hibernate/search/5.0/reference/en-US/html_single/#_bridgeprovider_associate_a_bridge_to_a_given_return_type" target="" class="regularLink">the BridgeProvider section of the documentation</a>. You could use it for example to contribute the missing converters for Java 8 Date/Time types.
</p>
<h3 class="wikiHeadline3" id="H-MoreLikeThisQueries"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-MoreLikeThisQueries">MoreLikeThis queries</a></h3>
<p class="wikiPara">
Using the new MoreLikeThis query capabilities you don't have to target specific fields but can provide an instance of an indexed object. This model is also known as <q>query by example</q> and will trigger a similarity query matching all fields (or a subset of your choice).
A full exaxmple can be seen on <a href="http://in.relation.to/2014/03/05/second-milestone-towards-hibernate-search-5-introducing-more-like-this-queries" target="" class="regularLink">this previous blog post</a>.
</p>
<h3 class="wikiHeadline3" id="H-DroppedDependencyToApacheSolr"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-DroppedDependencyToApacheSolr">Dropped dependency to Apache Solr</a></h3>
<p class="wikiPara">
Until this version Hibernate Search depended on Apache Lucene for most of the work, and also on Lucene's sister project Apache Solr to provide a richer set of analyzers. Since the Lucene project incorporated this functionality from Solr, there is no longer any need to depend on Solr artifacts.
</p>
<h3 class="wikiHeadline3" id="H-ImprovedModularityCleanWildFlyIntegration"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-ImprovedModularityCleanWildFlyIntegration">Improved modularity: clean WildFly integration</a></h3>
<p class="wikiPara">
With requirements such as OSGi support, other projects like <a href="http://capedwarf.org/" target="" class="regularLink">CapeDwarf</a> and <a href="http://infinispan.org/" target="" class="regularLink">Infinispan</a> integrating Hibernate Search (but excluding dependencies to <a href="http://hibernate.org/orm/" target="" class="regularLink">Hibernate ORM</a>), advanced needs for the <a href="http://hibernate.org/ogm" target="" class="regularLink">Hibernate OGM</a> project our integration API and modularity was extensively stretched and tested, resulting in lots of improvements which you might not directly notice, but will make it much easier to avoid dependency conflicts with any other library you might use, or integrate nicely in your favorite container / framework.
</p>
<p class="wikiPara">
One example is the new structure of the modules we provide for easy WildFly integration: highly encapsulated, and significantly less dependencies than previous versions.
</p>
<p class="wikiPara">
For example the JGroups backend can use a JGroups version of your choice, and it doesn't need to match the JGroups version of Infinispan even if Hibernate Search is using Infinispan as well (which depends on its own JGroups version); this will not be a problem, and JGroups wouldn't even be exposed to your application so in theory you could be using a third different version of the clustering library in your app directly.
In practice you would probably want to keep the versions aligned, but if you prefer otherwise it won't be a problem.
</p>
<h3 class="wikiHeadline3" id="H-NumericFields"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-NumericFields">Numeric Fields</a></h3>
<p class="wikiPara">
Any numeric property, including Calendar and Date types, are now by default indexed as a NumericField.
A NumericField is more efficient to perform range queries, so we think this is what you should be using in most cases. Of course it's still possible to explicitly annotate the property to revert to the old behaviour: this is just a change in the defaults.
</p>
<p class="wikiPara">
Please keep this change in mind when running queries, as you'll now need to query these as a NumericField. If you use our Query builder DSL this is going to be correct transparently, but if you use the Lucene native APIs to create queries the results won't match and you won't get any kind of warning.
</p>
<h2 class="wikiHeadline2" id="H-MigrationGuide"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-MigrationGuide">Migration Guide</a></h2>
<p class="wikiPara">
We normally keep track of any API change in our <a href="https://developer.jboss.org/wiki/HibernateSearchMigrationGuide" target="" class="regularLink">wiki's migration guide</a>; that's the right place to look for API / compatibility changes between any specific version.
</p>
<p class="wikiPara">
For a summary of the changes for people jumping from version 4.x to 5.x, we created a new <a href="http://hibernate.org/search/documentation/migrate/5.0/" target="" class="regularLink">dedicated Migration page on the website</a> which you can find from the <a href="http://hibernate.org/search/documentation/" target="" class="regularLink">Documentation</a> page.
</p>
<h2 class="wikiHeadline2" id="H-IndexMigration"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-IndexMigration">Index Migration</a></h2>
<p class="wikiPara">
Technically it is possible that this latest version of Lucene could read your existing indexes, but with such a large version increase of Lucene's code, and considering the numeric mapping changes, and the many changes in the Analyzers over time, we highly recommend you replace your old indexes and use the <i class="wikiEmphasis">MassIndexer</i> to trigger a fresh rebuilt.
</p>
<h2 class="wikiHeadline2" id="H-WhatsNext"><a href="http://in.relation.to/2014/12/17/a-fresh-new-major-release-hibernate-search-500-final#H-WhatsNext">What's next?</a></h2>
<p class="wikiPara">
We have several interesting plans ahead, but our priority is defined by feedback. Please let us know what you'd need, or even if it works great for you it's nice for us to hear about it and what you do with it.
You can get in touch with us with <a href="http://hibernate.org/community/" target="" class="regularLink">any of these media</a>, especially <a href="https://forum.hibernate.org/viewforum.php?f=9" target="" class="regularLink">the forums</a> should be a good starting point.
</p>
<p class="wikiPara">
This is what we hope to work in the near future:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> dynamic defined models (not strictly bound to annotated classes)</li>
<li class="wikiUnorderedListItem"> Alternatives to embedded Lucene backends: Apache Solr or ElasticSearch seem to be good candidates for this</li>
<li class="wikiUnorderedListItem"> Support for the new Java 8 types</li>
<li class="wikiUnorderedListItem"> Integration in WildFly 9</li>
<li class="wikiUnorderedListItem"> Support for Forge</li>
<li class="wikiUnorderedListItem"> Openshift / Docker / Kubernetes templates and guides</li>
<li class="wikiUnorderedListItem"> Improve performance (Always!)</li>
<li class="wikiUnorderedListItem"> Improved clustering functionality (master election?) on Infinispan/JGroups</li>
<li class="wikiUnorderedListItem"> Take better advantage of the new Lucene 4 capabilities (Faceting, query-time join, etc..) Can you suggest?</li>
</ul>
<p class="wikiPara">
This list is long, and I could easily expand. We could really user your help, especially as our small core team is not familiar with many of the other mentioned technologies: even if you don't feel like coding but are in the mood for bleeding edge testing that would be great.</p>
</div>
http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final/First Hibernate OGM release (aka 4.1 Final)2014-12-17T00:00:00Z2014-12-17T00:00:00ZEmmanuel Bernard
Today is a big day.
The first release of Hibernate OGM with final status. Ever! Don't be fooled by the 4.1 number.
Hibernate OGM is an object mapper for various NoSQL stores and offers the familiar JPA APIs.
This final version offers mapping for MongoDB, Neo4J, Infinispan and Ehcache.
It has been a long journey to reach this release, much longer than we thought.
And there is a long journey ahead of us to implement our full (and exciting!) vision.
But today is the time to celebrate: download this puppy and try it out.
What is Hibernate OGM?
Hibernate OGM is an object mapper.
It persists object graphs into...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Today is a big day.
The first release of Hibernate OGM with final status. Ever! Don't be fooled by the 4.1 number.
Hibernate OGM is an object mapper for various NoSQL stores and offers the familiar JPA APIs.
This final version offers mapping for MongoDB, Neo4J, Infinispan and Ehcache.
</p>
<p class="wikiPara">
It has been a long journey to reach this release, much longer than we thought.
And there is a long journey ahead of us to implement our full (and exciting!) vision.
But today is the time to celebrate: download this puppy and try it out.
</p>
<h2 class="wikiHeadline2" id="H-WhatIsHibernateOGM"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-WhatIsHibernateOGM">What is Hibernate OGM?</a></h2>
<p class="wikiPara">
Hibernate OGM is an object mapper.
It persists object graphs into your NoSQL datastore.
</p>
<p class="wikiPara">
We took great care to map the object structures the most natural way possible ;
we considered all the best practices for each of the NoSQL store we support.
Storing a association in a document store is vastly different than storing the same association in a graph database.
</p>
<pre class="wikiPreformatted">
// Unidirectional one to many association
// Basket
{
"_id" : "davide_basket",
"owner" : "Davide",
"products" : [ "Beer", "Pretzel" ]
}
// Products
{
"_id" : "Pretzel",
"description" : "Glutino Pretzel Sticks"
}
{
"_id" : "Beer",
"description" : "Tactical nuclear penguin"
}</pre>
<p class="wikiPara">
Hibernate OGM is 90% Hibernate ORM.
We changed the parts that are specific to SQL and JDBC,
but most of the engine remains untouched.
Same power, same flexibility.
</p>
<h2 class="wikiHeadline2" id="H-WhatIsTheAPILike"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-WhatIsTheAPILike">What is the API like?</a></h2>
<p class="wikiPara">
Very simple.
It's JPA. Or Hibernate ORM.
Map your entities with JPA annotations (or via XML),
then use JPA or the Hibernate native APIs to manipulate your objects.
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@PersistenceContext EntityManager em;
// the transaction boundary is really here to express the flush time
@Transactional
public void createSomeUser() {
Employer redHat =
em.createQuery("from Employer e where e.name = :name")
.setParamater("name", "Red Hat")
.getSingleResult();
User emmanuel = new User("Emmanuel", "Bernard");
user.setTwitterHandle("emmanuelbernard");
user.setEmployer(redHat);
em.persist(user);
}</pre>
<p class="wikiPara">
Our goal is to have a zero barrier of entry to NoSQL object mappers for people familiar with JPA or Hibernate ORM.
</p>
<p class="wikiPara">
Hibernate OGM also has a flexible option system that lets you customize some of the NoSQL store specifics or mapping options.
For example what is the MongoDB Write Concern for this entity (see code example)
or should associations be stored in the owning entity document.
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">@Entity
@WriteConcern(JOURNALED) // MongoDB write concern
public class User {
...
}</pre>
<h2 class="wikiHeadline2" id="H-AndQueries"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-AndQueries">And queries?</a></h2>
<p class="wikiPara">
We cannot talk about JPA without mentioning JP-QL.
Offering JP-QL support is challenging at many levels.
To mention only two, joins usually don't exist in NoSQL,
and each store has a very different set of query capabilities.
</p>
<p class="wikiPara">
Hibernate OGM can convert JP-QL queries to the underlying native query language of the datastore.
This functionality is still limited however.
Besides some queries will never map to JP-QL.
So we also let you write native queries specific to your NoSQL store
and map the results to managed entities.
</p>
<pre class="wikiPreformatted brush: java; gutter: false;">// native query using CypherQL
String query = "MATCH ( n:Poem { name:'Portia', author:'Oscar Wilde' } ) RETURN n";
Poem poem = (Poem) em.createNativeQuery( query, Poem.class ).getSingleResult();</pre>
<h2 class="wikiHeadline2" id="H-WhereCanIUseHibernateOGM"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-WhereCanIUseHibernateOGM">Where can I use Hibernate OGM?</a></h2>
<p class="wikiPara">
It works anywhere Hibernate ORM or any JPA provider works.
Java SE, Java EE, all should be good.
We do require JPA 2.1 though.
If you use WildFly (8.2), we have a dedicated module to make things even easier.
</p>
<h2 class="wikiHeadline2" id="H-ForWhichNoSQLStore"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-ForWhichNoSQLStore">For which NoSQL store?</a></h2>
<p class="wikiPara">
MongoDB, Neo4J, Infinispan and Ehcache are the one we consider stable.
We are working on CouchDB and Cassandra.
But really, any motivated person can try and map other NoSQL stores:
that's how a few got started.
We have an API that has proven flexible enough so far.
</p>
<h2 class="wikiHeadline2" id="H-CanHibernateOGMDoXYZ"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-CanHibernateOGMDoXYZ">Can Hibernate OGM do X, Y, Z?</a></h2>
<p class="wikiPara">
Probably. Maybe not.
</p>
<p class="wikiPara">
The best is to
talk to us in our <a href="https://forums.hibernate.org/viewforum.php?f=31" target="" class="regularLink">forums</a>,
check our <a href="http://hibernate.org/ogm/documentation" target="" class="regularLink">documentation</a> (we spent a lot of time on it),
and simply give it a try.
</p>
<p class="wikiPara">
Generally, the mapping support is complete.
Our query support is still a bit limited compared to where we want it to be.
It will improve quickly now that the foundations are here.
</p>
<p class="wikiPara">
We want to know what you need out of Hibernate OGM,
what feature you miss, which one should be changed.
Come and talk to us in our
<a href="https://forums.hibernate.org/viewforum.php?f=31" target="" class="regularLink">forum</a>
or <a href="http://hibernate.org/community/" target="" class="regularLink">anywhere</a> you can find us.
</p>
<h2 class="wikiHeadline2" id="H-HowToGetStarted"><a href="http://in.relation.to/2014/12/17/first-hibernate-ogm-release-aka-41-final#H-HowToGetStarted">How to get started?</a></h2>
<p class="wikiPara">
Most of what you need is available in our <a href="http://hibernate.org/ogm/" target="" class="regularLink">web site</a>.
There is a <a href="http://hibernate.org/ogm/documentation/getting-started/" target="" class="regularLink">getting started guide</a>,
and the more complete <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/" target="" class="regularLink">reference documentation</a>.
Get the full Hibernate OGM <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.0.Final/" target="" class="regularLink">distribution</a>.
And last but not least, for any help,
reach us via our <a href="https://forums.hibernate.org/viewforum.php?f=31" target="" class="regularLink">forum</a>.
</p>
<p class="wikiPara">
It would be impossible to mention all the persons that contributed to Hibernate OGM and how:
conversations, support, code, documentation, bootstrapping new datastore providers...
Many thanks to all of you for making this a reality.
</p>
<p class="wikiPara">
We are not done yet, far from it.
We have plenty of ideas on where we want to bring Hibernate OGM.
That's a discussion for another day.
</p>
</div>
http://in.relation.to/2014/12/12/hibernate-search-500-cr-2/Hibernate Search 5.0.0.CR22014-12-12T00:00:00Z2014-12-12T00:00:00ZHardy Ferentschik
While working on the finishing touches for Hibernate Search 5 and updating the projects integrating with Hibernate Search, we discovered a couple of issues which we needed to address to proceed. So without further ado, here comes:
Hibernate Search 5.0.0.CR2
Full change log available on Jira
Jars available on the JBoss Maven repository under the GAV org.hibernate:hibernate-search-orm:5.0.0.CR2
Zip and tar bundles on SourceForge
Enjoy!
...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
While working on the finishing touches for Hibernate Search 5 and updating the projects integrating with Hibernate Search, we discovered a couple of issues which we needed to address to proceed. So without further ado, here comes:
</p>
<h2 class="wikiHeadline2" id="H-HibernateSearch500CR2"><a href="http://in.relation.to/2014/12/12/hibernate-search-500-cr-2#H-HibernateSearch500CR2">Hibernate Search 5.0.0.CR2</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> Full change log available on <a href="https://hibernate.atlassian.net/secure/ReleaseNote.jspa?projectId=10061&amp;version=18852" target="" class="regularLink">Jira</a>
</li>
<li class="wikiUnorderedListItem"> Jars available on the <a href="https://repository.jboss.org/" target="" class="regularLink">JBoss Maven repository</a> under the GAV <i class="wikiEmphasis">org.hibernate:hibernate-search-orm:5.0.0.CR2</i>
</li>
<li class="wikiUnorderedListItem"> Zip and tar bundles on <a href="https://sourceforge.net/projects/hibernate/files/hibernate-search/5.0.0.CR2" target="" class="regularLink">SourceForge</a>
</li>
</ul>
<p class="wikiPara">
Enjoy! </p>
</div>
http://in.relation.to/2014/12/10/hibernate-ogm-410-cr-1-stable-mapping/Hibernate OGM 4.1.0.CR1 - stable mapping2014-12-10T00:00:00Z2014-12-10T00:00:00ZEmmanuel Bernard
After a huge push, we are now one release away from our Final version.
So without further due, I present you Hibernate OGM 4.1.0.CR1.
To sum it up:
stable mapping for each of the supported datastores (Infinispan, Ehcache, MongoDB, Neo4J)
new and better one cache per entity structure for key/value stores
improvement in Neo4J and MongoDB around embedded objects and composite ids
better documentation
Our goal for Hibernate OGM 4.1 is to offer a good Object Mapper for each of the primary datastores we target.
Go test it before the final and give us feedback!
zip release bundle
Maven repository server
getting started guide...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
After a huge push, we are now one release away from our Final version.
So without further due, I present you Hibernate OGM 4.1.0.CR1.
To sum it up:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> stable mapping for each of the supported datastores (Infinispan, Ehcache, MongoDB, Neo4J)</li>
<li class="wikiUnorderedListItem"> new and better one cache per entity structure for key/value stores</li>
<li class="wikiUnorderedListItem"> improvement in Neo4J and MongoDB around embedded objects and composite ids</li>
<li class="wikiUnorderedListItem"> better documentation</li>
</ul>
<p class="wikiPara">
Our goal for Hibernate OGM 4.1 is to offer a good Object Mapper for each of the primary datastores we target.
Go test it before the final and give us feedback!
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.0.CR1/" target="" class="regularLink">zip release bundle</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://repository.jboss.org/nexus/content/groups/public/org/hibernate/ogm/" target="" class="regularLink">Maven repository server</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/#ogm-gettingstarted" target="" class="regularLink">getting started guide</a> and <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/" target="" class="regularLink">reference documentation</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">user forum</a>
</li>
</ul>
<h2 class="wikiHeadline2" id="H-MappingStabilityAndDocumentation"><a href="http://in.relation.to/2014/12/10/hibernate-ogm-410-cr-1-stable-mapping#H-MappingStabilityAndDocumentation">Mapping stability and documentation</a></h2>
<p class="wikiPara">
This CR release signals the stable version of how we persist each data structure on the various datastores.
We strive to offer a mapping that is natural to each individual datastore.
We made some final improvements and are confident we can support this version.
</p>
<p class="wikiPara">
For each datastore, we documented how each JPA mapping is persisted
(entities, star-to-one, star-to-many, embedded id, etc.).
It makes for a tree-killer documentation but shows what is the truth for each mapping.
</p>
<p class="wikiPara">
We took the opportunity to improve the documentation even further and plan to finish that work for the final version.
</p>
<h2 class="wikiHeadline2" id="H-AdditionalKeyvalueCacheStructure"><a href="http://in.relation.to/2014/12/10/hibernate-ogm-410-cr-1-stable-mapping#H-AdditionalKeyvalueCacheStructure">Additional key/value cache structure</a></h2>
<p class="wikiPara">
Our tests have showed that storing each entity type and association in a dedicated cache
is actually more efficient than sharing the same cache for all entities.
Since we also think it is a more natural mapping, we now offer this option and make it the default.
</p>
<p class="wikiPara">
A <tt>User</tt> and an <tt>Address</tt> entities would lead to the following caches:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <tt>User</tt>: contains the users</li>
<li class="wikiUnorderedListItem"> <tt>Address</tt>: contains the address</li>
<li class="wikiUnorderedListItem"> <tt>associations_User_Address</tt>: contains the navigation from a user to its list of addresses</li>
</ul>
<p class="wikiPara">
An interesting side effect is that it makes the keys smaller in size and faster to compare.
Both Infinispan and Ehcache are benefiting from this.
</p>
<h2 class="wikiHeadline2" id="H-ImprovementsAroundEmbeddedObjectsEmbeddedIdsAndProperties"><a href="http://in.relation.to/2014/12/10/hibernate-ogm-410-cr-1-stable-mapping#H-ImprovementsAroundEmbeddedObjectsEmbeddedIdsAndProperties">Improvements around embedded objects, embedded ids and properties</a></h2>
<p class="wikiPara">
In Neo4J, (non id) embedded objects are now represented as individual nodes.
It is more in line with the connection behavior of graph databases.
</p>
<p class="wikiPara">
In MongoDB, embedded id foreign keys have been improved and are now represented as nested documents
like embedded ids were already.
We did not hear complains about this one, so we think you guys don't use composite ids with MongoDB.
That's good, keep doing that :)
</p>
<p class="wikiPara">
The <tt>null</tt> properties are no longer stored in any of the data stores.
While it might make some queries involving null values a bit harder,
it is the more natural mapping for the datastores.
</p>
<h2 class="wikiHeadline2" id="H-GoGoGo"><a href="http://in.relation.to/2014/12/10/hibernate-ogm-410-cr-1-stable-mapping#H-GoGoGo">Go, go, go</a></h2>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <a href="http://sourceforge.net/projects/hibernate/files/hibernate-ogm/4.1.0.CR1/" target="" class="regularLink">zip release bundle</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://repository.jboss.org/nexus/content/groups/public/org/hibernate/ogm/" target="" class="regularLink">Maven repository server</a>
</li>
<li class="wikiUnorderedListItem"> <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/#ogm-gettingstarted" target="" class="regularLink">getting started guide</a> and <a href="http://docs.jboss.org/hibernate/ogm/4.1/reference/en-US/html_single/" target="" class="regularLink">reference documentation</a>
</li>
<li class="wikiUnorderedListItem"> <a href="https://forum.hibernate.org/viewforum.php?f=31" target="" class="regularLink">user forum</a>
</li>
</ul>
</div>
http://in.relation.to/2014/12/09/hibernate-search-500-candidate-release-1-spotted-in-the-wild/Hibernate Search 5.0.0 Candidate Release 1 spotted in the wild2014-12-09T00:00:00Z2014-12-09T00:00:00ZSanne Grinovero
Version 5.0.0.CR1 of Hibernate Search is now available.
Numeric Field(s) being used by default
If you don't specify any FieldBridge for your Numeric attributes, or Date or Calendar fields, now Hibernate Search will encode them by default using Lucene's specialized NumericField format. This format was available since long in both Lucene and Hibernate Search, but so far you had to explicitly enable it as Hibernate Search would - by default - stick to the backwards compatible format of transforming these types into keywords (strings).
The NumericField format is much more efficient to perform range queries - which we expect being common for these...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Version <i class="wikiEmphasis"><tt>5.0.0.CR1</tt></i> of Hibernate Search is now available.
</p>
<h3 class="wikiHeadline3" id="H-NumericFieldsBeingUsedByDefault"><a href="http://in.relation.to/2014/12/09/hibernate-search-500-candidate-release-1-spotted-in-the-wild#H-NumericFieldsBeingUsedByDefault">Numeric Field(s) being used by default</a></h3>
<p class="wikiPara">
If you don't specify any <i class="wikiEmphasis">FieldBridge</i> for your Numeric attributes, or Date or Calendar fields, now Hibernate Search will encode them by default using Lucene's specialized <i class="wikiEmphasis">NumericField</i> format. This format was available since long in both Lucene and Hibernate Search, but so far you had to explicitly enable it as Hibernate Search would - by default - stick to the backwards compatible format of transforming these types into keywords (strings).
The NumericField format is much more efficient to perform range queries - which we expect being common for these types.
</p>
<p class="wikiPara">
Remember that - unless you had explicit field configuration - this implies that you might need to fix how your queries are created. By using the Hibernate Search Query DSL you will get an exception to warn you if you try to force it using the wrong type. If you're using the Lucene API directly, make sure to check you're getting the results you expect.
</p>
<h3 class="wikiHeadline3" id="H-APIChanges"><a href="http://in.relation.to/2014/12/09/hibernate-search-500-candidate-release-1-spotted-in-the-wild#H-APIChanges">API changes</a></h3>
<p class="wikiPara">
I have no other major changes to report regarding our public API; however for power users and other frameworks integrating with Hibernate Search you might notice a significant reorganization of our SPI.
We've documented all relevant changes in the <a href="https://developer.jboss.org/wiki/HibernateSearchMigrationGuide#jive_content_id_Hibernate_Search_500CR1" target="" class="regularLink">Migration Guide</a>.
</p>
<p class="wikiPara">
The <i class="wikiEmphasis">final</i> release of version 5 will be released very soon, so please make sure you test this quickly.
Any comment is welcome on the <a href="http://www.hibernate.org/community/mailinglists" target="" class="regularLink">mailing list</a> or via <a href="http://www.hibernate.org/community/irc" target="" class="regularLink">IRC</a>.
</p>
<p class="wikiPara">
Sanne</p>
</div>
http://in.relation.to/2014/12/03/the-jbug-london-event-of-next-january-is-all-about-hibernate-search-and-pizza/The JBUG London event of next January is all about Hibernate Search (and pizza)2014-12-03T00:00:00Z2014-12-03T00:00:00ZSanne Grinovero
If you are around in London the evening of the 14th of January, I would love to see you at our monthly JBUG event.
We'll start the evening with an introduction to Hibernate Search, including basics of concepts from Apache Lucene, and then discuss the novelties you'll find in Hibernate Search 5.0, before discussing the more advanced features.
That should be interesting both for those of you already familiar with the technology, and for those who never heard of it and are now wondering how and if it could help you.
The event will be at Skills Matters, organized by our partner C2B2,...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
If you are around in London the evening of the 14th of January, I would love to see you at our monthly JBUG event.
</p>
<p class="wikiPara">
We'll start the evening with an introduction to Hibernate Search, including basics of concepts from Apache Lucene, and then discuss the novelties you'll find in Hibernate Search 5.0, before discussing the more advanced features.
That should be interesting both for those of you already familiar with the technology, and for those who never heard of it and are now wondering how and if it could help you.
</p>
<p class="wikiPara">
The event will be at Skills Matters, organized by our partner C2B2, and after the demo we'll have plenty of time for pizza, beers and face to face discussions about all things Hibernate.
</p>
<p class="wikiPara">
Please find all venue details <a href="http://www.meetup.com/JBoss-User-Group/events/219038939/" target="" class="regularLink">on meetup.com</a> and don't forget to <a href="http://www.c2b2.co.uk/london_jbug_january_2015" target="" class="regularLink">register here</a>.</p>
</div>
http://in.relation.to/2014/12/02/some-exceptional-backports-to-maintenance-hibernate-search-releases/Some exceptional backports to maintenance Hibernate Search releases2014-12-02T00:00:00Z2014-12-02T00:00:00ZSanne Grinovero
Today we're releasing two maintenance versions of Hibernate Search:
Hibernate Search 4.4.6.Final - full changelog.txt
Hibernate Search 4.5.2.Final - full changelog.txt
Backporting performance improvements
Normally we would not backport new features to maintenance releases, but some of the great performance improvements of the new indexing engine of upcoming Hibernate Search 5 such as {HSEARCH-1693, HSEARCH-1699, HSEARCH-1725} seem to be very desirable. These are not introducing any API or functionality change, so we could backport them at virtually no risk.
This means you can now easily upgrade your Hibernate Search 4.4.x and 4.5.x applications without necessarily needing to migrate to Hibernate Search 5. Remember...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
Today we're releasing two maintenance versions of Hibernate Search:
</p>
<ul class="wikiUnorderedList">
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">Hibernate Search 4.4.6.Final</i> - full <a href="https://github.com/hibernate/hibernate-search/blob/4.4.6.Final/changelog.txt" target="" class="regularLink">changelog.txt</a>
</li>
<li class="wikiUnorderedListItem"> <i class="wikiEmphasis">Hibernate Search 4.5.2.Final</i> - full <a href="https://github.com/hibernate/hibernate-search/blob/4.5.2.Final/changelog.txt" target="" class="regularLink">changelog.txt</a>
</li>
</ul>
<h3 class="wikiHeadline3" id="H-BackportingPerformanceImprovements"><a href="http://in.relation.to/2014/12/02/some-exceptional-backports-to-maintenance-hibernate-search-releases#H-BackportingPerformanceImprovements">Backporting performance improvements</a></h3>
<p class="wikiPara">
Normally we would not backport new features to maintenance releases, but some of the great performance improvements of the new indexing engine of upcoming Hibernate Search 5 such as {<a href="https://hibernate.atlassian.net/browse/HSEARCH-1693" target="" class="regularLink">HSEARCH-1693</a>, <a href="https://hibernate.atlassian.net/browse/HSEARCH-1699" target="" class="regularLink">HSEARCH-1699</a>, <a href="https://hibernate.atlassian.net/browse/HSEARCH-1725" target="" class="regularLink">HSEARCH-1725</a>} seem to be very desirable. These are not introducing any API or functionality change, so we could backport them at virtually no risk.
</p>
<p class="wikiPara">
This means you can now easily upgrade your Hibernate Search 4.4.x and 4.5.x applications without necessarily needing to migrate to Hibernate Search 5. Remember though: there are a lot more improvements coming in 5! If you want all the nice improvements you'll have to eventually migrate.
</p>
<h3 class="wikiHeadline3" id="H-WhatWasNotBackported"><a href="http://in.relation.to/2014/12/02/some-exceptional-backports-to-maintenance-hibernate-search-releases#H-WhatWasNotBackported">What was not backported</a></h3>
<p class="wikiPara">
These new backends were created because performance testing of the Infinispan indexing engine highlighted some problems in our backend when using an Infinispan Directory; so while these patches provide an impressive boost on their own, they will be far more effective when paired up with latest Infinispan 7 as some changes where applied to Infinispan too. But we're not upgrading these maintenance branches of Hibernate Search 4 to Infinispan 7 as that would break all of your configurations. To take benefit of the updated Infinispan integration you'll need Hibernate Search 5.
Another great reason to move to Hibernate Search 5 is of course the update to latest Apache Lucene; so these updates announced today should be a nice an easy performance boost but if you are serious about needing the highest speed please keep testing version 5.
</p>
<h3 class="wikiHeadline3" id="H-FeedbackNeeded"><a href="http://in.relation.to/2014/12/02/some-exceptional-backports-to-maintenance-hibernate-search-releases#H-FeedbackNeeded">Feedback needed!</a></h3>
<p class="wikiPara">
While these impressive improvements were created after specific diagnostics work on Infinispan, the benefits are not Infinispan specific: you should be able to experience a significant throughput boost with any storage. The exception is if you were using the NRT backend: I don't expect you to see any benefit in that case. Although if you were forced to use NRT because of throughput needs but didn't like the tradeoffs, you might no longer need to use NRT as the new non-NRT backend could be nearly as efficient.</p>
</div>
http://in.relation.to/2014/11/21/more-performance-improvements-in-hibernate-search-500-beta-3/More performance improvements in Hibernate Search 5.0.0.Beta32014-11-21T00:00:00Z2014-11-21T00:00:00ZSanne Grinovero
You can now upgrade to Version 5.0.0.Beta3 of Hibernate Search, and benefit from the following improvements:
Indexing Performance
We did some further polishing of the shiny new backend improvements introduced by last week. I would be really happy to get some feedback on this, as you should be able to get a very significant performance boost on index writing - whatever the storage technology you're using. We're preparing some large scale tests, but the environments we can test on are limited so I'd be happy if you could send us a note on what your experience with it looks like.
The new design...
<div id="documentDisplay" class="documentDisplay">
<p class="wikiPara">
You can now upgrade to Version <i class="wikiEmphasis"><tt>5.0.0.Beta3</tt></i> of Hibernate Search, and benefit from the following improvements:
</p>
<h3 class="wikiHeadline3" id="H-IndexingPerformance"><a href="http://in.relation.to/2014/11/21/more-performance-improvements-in-hibernate-search-500-beta-3#H-IndexingPerformance">Indexing Performance</a></h3>
<p class="wikiPara">
We did some further polishing of the shiny new backend improvements introduced by last week. I would be really happy to get some feedback on this, as you should be able to get a very significant performance boost on index writing - whatever the storage technology you're using. We're preparing some large scale tests, but the environments we can test on are limited so I'd be happy if you could send us a note on what your experience with it looks like.
</p>
<p class="wikiPara">
The new design should have a significant improvement in throughput, but also requires less locking, needs less threads and will result into less pressure on GC as it has a lower allocation rate.
</p>
<h3 class="wikiHeadline3" id="H-JDK9Compatibility"><a href="http://in.relation.to/2014/11/21/more-performance-improvements-in-hibernate-search-500-beta-3#H-JDK9Compatibility">JDK9 compatibility</a></h3>
<p class="wikiPara">
We now have continuous integration running for Java 9 (preview builds) running as well. Except the OSGi integration tests running in Apache Karaf, everything else seems to work fine.
</p>
<h3 class="wikiHeadline3" id="H-APIChanges"><a href="http://in.relation.to/2014/11/21/more-performance-improvements-in-hibernate-search-500-beta-3#H-APIChanges">API changes</a></h3>
<p class="wikiPara">
We're now polishing the API, and it's possible that this might be the last Beta. Two very frequently used interfaces were renamed; please don't miss the <a href="https://developer.jboss.org/wiki/HibernateSearchMigrationGuide#jive_content_id_Hibernate_Search_500Beta3" target="" class="regularLink">Migration Guide</a>.
</p>
<p class="wikiPara">
As always, looking forward for your experience with it! ideas and suggestions on the <a href="http://www.hibernate.org/community/mailinglists" target="" class="regularLink">mailing list</a> or via <a href="http://www.hibernate.org/community/irc" target="" class="regularLink">IRC</a>.
</p>
<p class="wikiPara">
Sanne</p>
</div>