Home » Author Archives: Brian Porter

Author Archives: Brian Porter

How to use Hibernate to generate a DDL script from your Play! Framework project

jboss-hibernate-logo

Ok, so you have been using the hiber­nate prop­erty name=“hibernate.hbm2ddl.auto” value=“update” to con­tin­u­ously update your data­base schema, but now you need a com­plete DDL script? Use this method from you Global Class onStart to export the DDL scripts.  Just give it the pack­age name (with path) of your Enti­ties as well as a file name: public void onStart(Application app) { exportDatabaseSchema("models", ...

Read More »

Programming a simple slot machine game using Java

java-logo

No mat­ter how sim­ple or com­plex the game is, Java can do the job! On this post, let’s take a look at how begin­ners of Java pro­gram­ming can make a sim­ple, yet fully func­tional slot machine. Slot machines have been around for a long time, but its enter­tain­ment value doesn’t seem to fade one bit. Inter­Casino, the first web­site to offer ...

Read More »

How to implement a Session Timeout in Play Framework 2

play-framework-logo

If you fol­low the Play Frame­work 2 guide for imple­ment­ing authen­ti­ca­tion: http://​www​.playframe​work​.com/​d​o​c​u​m​e​n​t​a​t​i​o​n​/​2​.​2​.​2​/​J​a​v​a​G​u​i​de4 — you will notice that there is no ses­sion time­out in Play Frame­work 2. It was there in Play Frame­work 1, but Play Frame­work 2 fol­lows a dif­fer­ent approach. I you want to imple­ment your own ses­sion time­out, then fol­low the guide for set­ting up authen­ti­ca­tion, by extend­ing ...

Read More »

How to configure an SSL Certificate with Play Framework for https

play-framework-logo

I spent hours try­ing to get this to work, and in the end, then prob­lem was that I did not gen­er­ate the CSR (Cer­tifi­cate Request) myself with the keytool. I kept get­ting this error when I tried access­ing Play with https: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated The prob­lem ended up being that the key­store I cre­ated and imported the SSL cer­tifi­cate ...

Read More »

How to use Reflection to Document your Data Model based on JPA Annotations

java-interview-questions-answers

So using JPA, Hiber­nate or EBeans is cool when you can just anno­tate your Java classes, but haven’t you always wished you could “gen­er­ate” doc­u­men­ta­tion of your data model from the code? Pulling infor­ma­tion of the the JPA / Hiber­nate  and other val­i­da­tion annotations? Assum­ing you have all those nice Anno­ta­tions in your beans:           @Entity @Table(name ...

Read More »

Using twitter4j with Play! Framework and Secure Social is this easy

play-framework-logo

Dur­ing yesterday’s per­sonal Hackathon, I started a project which I might intro­duce here some­time. But the coolest rev­e­la­tion was (again) how easy it was to get up and running. Cre­ate a new Play Project Add Secure Social and con­fig­ure it for Twit­ter, and use the InMem­o­ryUserSer­vice from the exam­ples. (all this is described here http://securesocial.ws/guide/getting-started.html and only takes a minute) ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.