The most natural approach to solve this, is to declare language name as @NaturalId
Code:
@Column(name = "LANGUAGE_NAME")
@NaturalId (mutable = true)
private String name;
Then in your business code, you can check the existance of a language by:
Language lang = (Language) session.bySimpleNaturalId(Language.class).load(newlanguage);
if (lang == null) { // create the new language only if it does not exist yet
lang = new Language(newlanguage);
session.save(lang);
}
Furthermore the @NaturalId declaration has as conseguence that an unique index will be defined on column LANGUAGE_NAME when
you generate the schema. This avoids duplicate entries a priori.