Skip to content

Instantly share code, notes, and snippets.

@Embeddable
class Address {
...
@Convert(...) private String city;
}
@Entity
@Convert(attributeName="homeAddress.city", disableConversion=true)
class Person {
ConstraintMapping mapping = config.createConstraintMapping();
mapping.type( GreetingService.class )
.method( "greet", User.class )
.returnValue()
.valid()
.convertGroup( Default.class ).to( User.class )
.convertGroup( Foo.class ).to( Bar.class );
//more "fluent" name?
ConstraintMapping mapping = config.createConstraintMapping();

Bean Validation 1.1 Feature Spotlight - Expression Language

It has been a couple of weeks since Bean Validation 1.1 has gone final. In the mean time, the Java EE 7 platform spec has been finalized, so it's about time to have a closer look at what you can expect from this update to the Bean Validation spec and its reference implementation, Hibernate Validator 5. Over the following weeks, we'll discuss the most exciting new features in a series of blog posts, starting today with the usage of expression language in error messages.

One of the lesser known facts about Java EE is that the Unified Expression Language (UEL) can not only be used in JSF or JSP pages, but actually in any application layer. Bean Validation leverages this to support the creation of constraint violation messages in a dynamic manner.

As an example, let's take a look at th

@emmanuelbernard
emmanuelbernard / beep.pl
Last active December 17, 2015 06:58 — forked from anonymous/beep.pl
Do not look for (and expand) message and nick when reacting to DCC sig
#
# Copyright (C) 2006-2012 Sebastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2011 Nils Görs <weechatter@arcor.de>
# Copyright (C) 2011 ArZa <arza@arza.us>
# Copyright (C) 2013 Emmanuel Bernard <code@mel.emmanuelbernard.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
private class Indexer {
public void consumes(Iterator<Tuple> entityTuples) {
while (Tuple tuple = entityTuples.next() != null) {
Entry entry = convertToEntry(tuple);
pushToExecutorQueue(entry);
}
//pushToExecutorQueue, execute method
public execute() {
#!/bin/bash
# Script to loop on local and remote branches, to delete all those which are
# already merged in master.
# Assumes "$USER" as your remote repository and "master" as your main branch.
# Careful if you use branches as tags!
#
# Inspired from http://devblog.springest.com/a-script-to-remove-old-git-branches
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
# Copyright (c) 2012 Sanne Grinovero
# Copyright (c) 2012 Emmanuel Bernard - made remote repo parameterized
@emmanuelbernard
emmanuelbernard / A1_NumberOfNodes_SingleNode.java
Created March 8, 2012 18:22 — forked from gunnarmorling/A1_NumberOfNodes_SingleNode.java
Options for property pathes for method validation
//Option #A1 (currently in draft): Have a single node representing a parameter or return value *and* the hosting method/constructor
//path to @NotNull on the "book" parameter of addBook()
Node(name=book, methodDescriptor=..., parameterDescriptor=..., constructorDescriptor=null)
//path to @NotNull on the "title" attribute of the book passed as argument to addBook()
Node(name=book, methodDescriptor=..., parameterDescriptor=..., constructorDescriptor=null)
Node(name=title, methodDescriptor=null, parameterDescriptor=null, constructorDescriptor=null)
//path to @NotNull on the "title" attribute of the 4th book in the list passed as argument to addAllBooks()
@emmanuelbernard
emmanuelbernard / hsearch4beta2.md
Created September 29, 2011 09:10 — forked from hferentschik/hsearch4beta2.md
Hibernate Search 4.0 Beta 2: no more Core mandatory dependency

Continuing our journey towards Hibernate Search 4, we have decided to add a Beta2 to the schedule.

The main feature is the full abstraction of Hibernate Search from Hibernate Core. This is especially good news for Infinispan Query users who won't have to drag Hibernate Core and its dependencies anymore. It is now also possible to write an integration between Hibernate Search and another datastore: all the contracts have been fleshed out.

If we have done our job right, you will have nothing to change in your Maven dependency declaration. 'hibernate-search' is still the main artifact to include, but it is now just a shell depending on the new 'hibernate-search-orm' module.

We also have upgraded to Lucene 3.4 which contains performance improvement and important bug fixes.

@emmanuelbernard
emmanuelbernard / gist:1153877
Created August 18, 2011 11:26
Blog for HSearch 4 Alpha 1
The release cycle of Hibernate Search 4 has begun. Alpha 1 is out. We already have many
things implemented so it's more an Alpha3 than anything else ;)
Hibernate Search 4 goals are two folds:
= Be compatible with the new Hibernate Core 4 releases.
= Make the necessary architecture change to reach the future goals of Hibernate Search.
In particular, making Hibernate Search independent from Hibernate Core and allowing more
scalable "cloud-tainted" backends.
Place 1:
Queen: Aslak+Wife
Queen: Lincoln III
Twin, Cot1, Cot2 - To be decided by Dan, ALR, (open slot...Wesley Hayles?)
Place 2:
Queen: Emmanuel
Queen: