Maybe you could just use a very flexible MatchMode?
Quote:
static MatchMode ANYWHERE
Match the pattern anywhere in the string
static MatchMode END
Match the end of the string to the pattern
static MatchMode EXACT
Match the entire string to the pattern
static MatchMode START
Match the start of the string to the pattern
Then create a sample object with the octet you're searching for in the example class. Here's a code snippet from the
Hibernate tutorials on my website:
Code:
User user = new User();
user.setPassword("PASS");
Example example = Example.create(user);
example.enableLike(MatchMode.ANYWHERE);
example.ignoreCase();
example.excludeProperty("verified");
How to Use the Criteria API in you Hibernate Applications: A Simple Tutorial