@Embeddable and DISTINCT keyword causes duplicate column names in SQL SELECT clause

Posted by John Manko | Posted in Computers & Technology, Java | Posted on 01-07-2011mail

Using DISTINCT keyword on an Enity classes with an @Embeddable primary-key results in an EclipseLink error. This affects EclipseLink as of 2.2.0.v20110202-r8913. Details after the jump.

Read the rest of this entry »

search

Unexpected Problems With Glassfish v3.1 Update, Part 1

Posted by John Manko | Posted in Java | Posted on 27-03-2011

Ever get that feeling like an entire day, if not days, is going to be wasted as a result of tracking down a compatibility issue that leaves you rushing to find a fix?  That’s exactly how I felt after I upgraded my test instance of Glassfish from v3.0.1 to v3.1, breaking compatibility with existing applications.  I, unfortunately, didn’t thoroughly read the EclipseLink Bug List or notes on Richfaces v3.* integration with JSF 2.0.  In fact, I didn’t read it at all.

For the purpose of this post, I want to detail the immediate and significant problems that may result after a GFv3.1 upgrade.  The initial bug I encountered has to do with EclipseLink and it’s handling of column/table name comparisons, and ultimately throws an org.eclipse.persistence.exceptions.ValidationException exception.  Case-sensitivity becomes an issue with this release, and a fix is not available until release 2.2.1 at the earliest (currently at 2.2.0.v20110202-r8913).  There is a workaround, however.  Next, I’ll look into the care that must be taken with running Richfaces 3.3.3 in a JSF 2 environment. Read the rest of this entry »

jobs

A Case Against JPA

Posted by John Manko | Posted in Java | Posted on 28-09-2009

Here are some numbers for JPA generated queries verses a custom formatted one:

Based on the following query:

em.createQuery(" SELECT object(o) FROM INTERNALIPADDRESSBINDING o WHERE o.internalIpAddress.ipAddress = :ip AND o.macAddress.macAddress = :mac AND o.bindTimestamp = :bind ")

JPA generated query based on Entity classes and foreign keys:

SELECT t0.ID,
       t0.BINDTIMESTAMP,
       t0.MACADDRESS_MACADDRESS,
       t0.internalIpAddress_ipAddress
FROM   INTERNALIPADDRESSBINDING t0,
       MACADDRESS t2,
       INTERNALIPADDRESS t1
WHERE  ((
         ((t1.IPADDRESS ='4.4.4.4') AND (t2.MACADDRESS = 'ZZ:ZZ:ZZ:ZZ:ZZ:ZZ'))
         AND
         (t0.BINDTIMESTAMP = '2009-09-22 15:01:53.0')
        )
        AND
        (
         (t1.IPADDRESS =t0.internalIpAddress_ipAddress)
         AND
         (t2.MACADDRESS = t0.MACADDRESS_MACADDRESS)
        )
       );

 Empty set (20.53 sec)

My query:

SELECT t0.ID,
       t0.BINDTIMESTAMP,
       t0.MACADDRESS_MACADDRESS,
       t0.INTERNALIPADDRESS_IPADDRESS
FROM   INTERNALIPADDRESSBINDING t0
WHERE  t0.INTERNALIPADDRESS_IPADDRESS = '4.4.4.4'
   AND t0.MACADDRESS_MACADDRESS = 'ZZ:ZZ:ZZ:ZZ:ZZ:ZZ'
   AND t0.BINDTIMESTAMP = '2009-09-22 15:01:53.0';

 Empty set (1.35 sec)
e-mail
mail
notice