Providing the finest quality of
solutions and services to our clients

The story behind the name

This is the story behind how the name Fingerprints Software came about. Back in 2005 a group of passionate university graduates decided to open up a Software Consultancy. A bold move in itself entering the market with no experience and permanent employment to hold down as well. Two of those graduates are still part of the Company today and that is how we know what is behind the name Fingerprints Software. From what we’ve been told it was a lengthy discussion that these graduates had in order to come up with the name, even though now it seems so simple an clear. One thing they were sure of back then is that whatever they did in the industry they wanted it to have a unique flavour. They wanted whatever they touched to stand out; leave an imprint. An imprint of quality code and design that would be unique to their company. Let’s call this the companies unique fingerprint on the industry. This fingerprint would be a part of every aspect of the company from actual deliverables to the way in which they deal with their employees, partners and clients. We have gone a long way to achieve this fingerprint and hope to continue leaving it wherever we go in future. So I think its quite fitting that we are called Fingerprints Software.

Criteria Queries with Hibernate any association

So I’ve been through a lot of Googling as well as reading to try and resolve what seems to be a simple problem and in the end could not find one definitive guide on how to write a criteria query for a hibernate mapping that uses the <any> association type.
The basic mapping being:

<class name="MyClass">
<any id-type="long" meta-type="integer" name="someProperty">
<meta-value class="SomeClass" value="0"></meta-value&gt;
<meta-value class="OtherClass" value="1"></meta-value&gt;
<column name="CLASS"></column&gt;
<column name="CLASS_ID"></column>
</any>
</class>

The query we want to execute is to get all the MyClass objects based on the value of aProperty in OtherClass. One way to query is with the use of detached criteria:

Criteria criteria = session.createCriteria(MyClass.class)

DetachedCriteria detachedCriteria = DetachedCriteria.forClass(OtherClass.class)
.add(Restrictions.eq("aProperty", "propertyValue");
detachedCriteria.setProjection(Projections.property("id"));
criteria.add(Subqueries.propertyIn("someProperty.id", detachedCriteria));
criteria.add(Restrictions.eq("someProperty.class", OtherClass.class.getName()));

I’m not completely happy with this just yet and this may not be the best way but so far it lets me overcome the hurdle of trying to query against an any association.