Testing JPA code with Mockito answers

Introduction In JPA when we want to insert an entity in the database we use the EntityManager.persist(..) method. In addition to saving the entity the persist method will also assign a value to the field of the entity annotated with the @Id annotation (according to the configured @GenerationType). This behaviour is convenient but can be […]

Statically weaving JPA entities for EclipseLink using Maven

EclipseLink provides advanced JPA features such as lazy-loading, change tracking and fetch groups using bytecode weaving. To use bytecode weaving you can either dynamically instrument your entity classes at runtime (via a jvm agent) or use a tool to statically process the .class files after compilation. In this post we will present how to use […]

C# Extension methods

Scott Hanselman has a post about a user who doesn’t get what is cool about Ruby. In the post you can find the below example that compares Java and Ruby in terms of code readability. The Java code: new Date(new Date().getTime() – 20 * 60 * 1000) The Ruby code: 20.minutes.ago The article was interesting […]