Home » JVM Languages » Page 50

JVM Languages

Grails SQL Logging part 2 – groovy.sql.Sql

I discussed options for logging Hibernate-generated SQL in an earlier post but today I was trying to figure out how to see the SQL from groovy.sql.Sql and didn’t have much luck at first. The core problem is that the Sql class uses a java.util.logging.Logger (JUL) while the rest of the world uses a Log4j logger (often with a Commons Logging or SLF4J ...

Read More »

Your first message – discovering Akka

Akka is a platform (framework?) inspired by Erlang, promising easier development of scalable, multi-threaded and safe applications. While in most of the popular languages concurrency is based on memory shared between several threads, guarded by various synchronization mehods, Akka offers concurrency model based on actors. Actor is a lightweight object which you can interact with barely by sending messages to ...

Read More »

Grails: Autodiscovery of JPA-annotated domain classes

There are some issues to be fixed with the support for adding JPA annotations (for example @Entity) to Groovy classes in grails-app/domain in 2.0. This is due to the changes made to adding most GORM methods to the domain class bytecode with AST transformations instead of adding them to the metaclass at runtime with metaprogramming. There is a workaround – ...

Read More »

Quartz 2: Exploring different scheduling types

We often think of Cron when we want to schedule a job. Cron is very flexible in expressing an repeating occurance of an event/job in a very compact expression. However it’s not answer for everything, as I often see people are asking for help in the Quartz user forum. Did you know that the popular Quartz 2 library provide many ...

Read More »

Testing Quartz Cron expressions

Declaring complex Cron expressions is still giving me some headaches, especially when some more advanced constructs are used. After all, can you tell when the following trigger will fire '0 0 17 L-3W 6-9 ? *'? Since triggers are often meant to run far in the future, it’s desired to test them beforehand and make sure they will actually fire when ...

Read More »

Logging Hibernate SQL

There are two well-known ways to log Hibernate SQL in Grails; one is to add logSql = true in DataSource.groovy (either in the top-level block for all environments or per-environment)             dataSource { dbCreate = ... url = ... ... logSql = true } and the other is to use a Log4j logging configuration: log4j ...

Read More »

JavaOne 2012: Scala Tricks

The first session I attended after lunch was Venkat Subramaniam‘s ‘Scala Tricks,’ held in the Hilton Golden Gate 3/4/5 conference room area. This is the first session in which I switched my planned session during JavaOne. I switched it last night as I look at my day’s schedule and realized that, although excited about Lambda, I felt like I had ...

Read More »

JavaOne 2012: What’s New in Scala 2.10

After getting lunch, I went to Hilton Golden Gate 6/7/8 to see Martin Odersky‘s (Typesafe) presentation ‘What’s New in Scala 2.10.’ It is always an opportunity to hear a language’s creator discuss the language that he created. Odersky stated by providing a brief history of Scala: 1996-1997 Pizza 1998-2000 GJ, Java generics, javac 2003-2006 The Scala ‘Experiment’ 2006-2009 Industrial Strength ...

Read More »

Getting started with Scala and Scalatra – Part IV

Welcome to the last part of this series of tutorials on scala and scalatra. In this part we’ll look at how you can use Akka to handle your requests using an asynchronous dispatcher, how to use subcut for dependency injection and finally how you can run the complete API in the cloud. In this example I’ve used openshift from JBoss ...

Read More »