Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: From Hibernate to straight JPA Date: Fri, 10 Jul 2015 20:13:32 +0200 Organization: Decebal Computing Lines: 23 Message-ID: <87egkfhodv.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="7642"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GrThJSYuetmi9gTLHCaiiz1hvo3hoSsE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:M3Xeho5+Af/6K5BJrW2+FwzK/WQ= sha1:pPDJQDoPQ3eI6lup7rbIz8uLt8U= Xref: csiph.com comp.lang.java.programmer:31984 We are asked to change some software. At the moment one of the things that has to be replaced is Hibernate. They want to use straight JPA, so it is easy to switch from Hibernate, to openJPA, to … One of the annotations that is used is: @NotEmpty(message = "Field is not filled") with the import: import org.hibernate.validator.constraints.NotEmpty; My college wants to use: @NotNull(message = "Field is not filled") @Size(message = "Field is not filled", min = 1) I do not like this. It certainly is not DRY. (It is used hundreds of times.) I prefer to define our own NotEmpty. But I have never worked with annotations. How to do this? Also what is a good resource to learn about JPA and annotations? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof