Monday Aug 17, 2009

LOTD #22: How to inject JPA resources ? - PersistenceUnit vs PersistenceContext

Java Persistence API defines a standard object/relational mapping using POJOs. In JPA, a persistence unit is described using "persistence.xml", bundled with the web application, injected into your web application and then POJOs are used to access all the information from the underlying persistence mechanism such as a database.

JPA can injected into your application couple of different ways as shown below:

EntityManagerFactory emf;


EntityManager manager;

Which one is preferred, why, and pros/cons are very clearly explained in (slightly old but very relevant) this blog. It also discusses a JNDI approach.

In case you are interested in the summary:
  • Use "@PersistenceUnit EntityManagerFactory" for Servlets because of thread safety
  • Use "@PersistenceContext EntityManager" in EJBs for simpler/cleaner code
Read other JPA related entries.
All previous entries in this series are archived at LOTD.

Technorati: lotd glassfish jpa javaee persistence

Wednesday Apr 22, 2009

LOTD #21: Production Deployment Tips for running Rails on GlassFish v2 using Windows

SeaChange Affinity uses Rails and GlassFish as their deployment platform. One of their core developers posted tips based upon their experience so far and they are available at:

Rails on GlassFish v2 using Windows

Here are some of the quotes:

Glassfish can really handle a heavy load


handling 400 simultaneous users under a supremely heavy load, the memory was holding great

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish jruby rubyonrails windows

Thursday Apr 09, 2009

LOTD #20: How to create a JPA application using GlassFish Tools Bundle for Eclipse ?

Here is a great screencast (from the community) that shows how to create a JPA application using EclipseLink and deploy on GlassFish v2.1 - all using GlassFish Tools Bundle for Eclipse.

Click on the image below for the video:


I'll work on a MySQL version of it :)

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish eclipse jpa javadb screencast

Wednesday Apr 01, 2009

LOTD #18: Campus Ambassadors presenting on GlassFish - France & India

Agnieszka and Julien, the Sun Campus Ambassadors at INSA Lyon presented on GlassFish. Read the complete report here and enjoy a picture:

Here is another report on Hibernate/NetBeans/GlassFish presentation - again at INSA Lyon.

Dwarkanath, the Campus Ambassador at Sastra, presented on GlassFish as part of Student Technology Camp. Read the complete report here and enjoy a picture:

If you are interested in learning/talking about GlassFish at your university, provides a comprehensive set of slides (with speaker notes), demos, screencasts, training materials and other resources to get you started!

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish students campusambassadors france india spotlight

Sunday Feb 08, 2009

LOTD #17: Sun GlassFish Enterprise Server Administration and Deployment Course - SAS 4455

Interested in learning how to configure, administer, and deploy web applications, EJB applications, and Web services on GlassFish ?

This 4-day instructor-led workshop (with numerous hands-on labs) introduces you to various Sun GlassFish Enterprise Server (GlassFish) concepts and functions ranging from introductory to advanced and provides you with hands-on experience via remote labs. You also learn to enable various advanced GlassFish features, such as in-memory replication, high availability database (HADB), load balancing, monitoring and logging, clustering, and security.

Upon completion of this course, students should be able to:
  • Install, upgrade, migrate, and uninstall GlassFish
  • Configure GlassFish
  • Create a clustered GlassFish environment
  • Deploy applications in GlassFish
  • Perform logging and monitoring in GlassFish
  • Install and configure the load balancer plug-in
  • Configure and use in-memory replication
  • Configure and use HADB for high availability
  • Configure advanced features of GlassFish
  • Configure the security features of GlassFish
  • Configure and work with databases
  • Work with Sun Java System Message Queue (Message Queue) Clustered Application Server
The class is offered in different cities across the United States. You can even request a dedicated class for your organization.

Register today!

If the timings/location don't work out, you can even take an online version of this course from SAS-1600: GlassFish Application Server: Administration Bundle.

All previous links in this series are archived at LOTD.

Technorati: lotd glassfish administration deployment training course

Tuesday Feb 03, 2009

LOTD #16: Hotspot Flags, JRuby Version String, and JRuby/MRI Benchmark

This post shares 3 links that were recently published.

The first one is about the Favorite Hotspot JVM Flags by Charlie. See how you can use them for tweaking performance or investigating runtime metrics.

The second one is about using JRuby Version String. It explains the detailed meaning of the version string printed by "jruby --version". If you read it carefully then you know the date, hardware, platform, SVN revision and even state of Charlie's local git-svn clone.

The third and the last one is about benchmark results between MRI and JRuby with the following summary:

From my tests it appears that MRI is faster in single threaded mode, but JRuby makes up for the loss big time in the multi-threaded tests. It's also interesting to see that the multi-threaded mode gives MRI(green threads) a performance boost, but it's nowhere close to the boost that JRuby(native threads) can squeeze out from using multiple threads.

Read Igor's report for more results.

And while you are reading this entry, did you know that GlassFish Gem 0.9.2 was recently released ? Use it for running your Rails applications seamlessly :)

All previous entries in this series are archived at LOTD.

Technorati: lotd glassfish v3 gem jruby ruby hotspot vm

Wednesday Dec 03, 2008

LOTD #15: Deploying Merb application on GlassFish v3 using Warbler

GlassFish v3 with Merb and Warbler explains how to use Warbler to deploy a Merb application on GlassFish v3. Here is a quote from the blog:

this lovely server had a gem which you can use to fire up a Glassfish server. Easy as pie and within no time at all we were developing our Merb app on Glassfish.

The blog requires some workaround for Warbler and Nick is planning to fix them in the next rev. And other workaround is required because of Webrat's recently introduced dependency on Nokogiri which does not run on JRuby yet.

In addition, TOTD #52 explains how to deploy a Merb application using GlassFish gem and TOTD #53 explains how to create a scaffold in Merb.

Submit your Merb/GlassFish bugs here, talk to us using GlassFish Forum, and get the latest information on JRuby wiki.

All previous entries in this series are archived at LOTD.

Technorati: lotd glassfish v3 gem warbler merb

Sunday Nov 23, 2008

LOTD #14: New Whitepaper: GlassFish High Availability Reference Configurations for a Virtualized Environment

GlassFish v2 allows you to configure cluster of multiple nodes/instances to meet various availability requirements, from the highly scalable service availability configuration to the business-critical, 99.999% service-and-data availability configuration. A cluster can be deployed using different toplogies with a choice of service/data availability, in-Memory/HADB, co-located/non-colocated and other factors. This new white paper explains reference configurations on that can be used for deploying business services.

Access it here!

All previous entries in this series are archived at LOTD.

Technorati: lotd glassfish clustering whitepaper

Tuesday Nov 11, 2008

LOTD #13: Warbling with RMagick on GlassFish

GlassFish with RMagick explains the Warbler configuration required for using RMagick with GlassFish.

Did you know Rails application can be natively deployed on GlassFish v3 Prelude ? And you can even buy production support!

All previous entries in this series are archived at LOTD.

Technorati: lotd rubyonrails rmagick glassfish

Tuesday Nov 04, 2008

LOTD #12: Technorati State of the Blogosphere 2008 released State of the Blogosphere 2008. Here are some results from the report:

All previous entries in this series are archived at LOTD.

Technorati: lotd blogosphere technorati 2008

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« October 2016