adsense szeles

Tuesday, July 22, 2014

"ORA-01795: maximum number of expressions in a list is 1000"

I was doing something like SELECT [...] WHERE SOMETHING IN (...).
Why exactly 1000?

Friday, July 4, 2014

Java reflection: get value of nested fields

Scenario: we have a bean with singular and associated fields. Associated fields have nested fields, too. We have two instances of the bean, some original and a modified version. We created two annotations, @Audited and @NestedAudit. The first is used for singular fields, the others for associated fields. We want to write some log information of the updated fields in both level. The code is as follows.

for(Field f : class.getDeclaredFields()) {
   if(f.isAnnotationPresent(Audited.class)){
    try {
     f.setAccessible(true);
     Object a = f.get(original);
     Object b = f.get(updated);
     if(!Objects.equal(a, b)) {
      // log change audit
     }
    } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
    }
   }

   if(f.isAnnotationPresent(NestedAudit.class)){
    for(Field g : f.getType().getDeclaredFields()) {
     if(g.isAnnotationPresent(Audited.class)){
      try {
       f.setAccessible(true);
       g.setAccessible(true);
       Object a = g.get(f.get(original));
       Object b = g.get(f.get(updated));

       if(!Objects.equal(a, b)) {
        // log nested change audit
       }
      } catch (IllegalAccessException e) {
       throw new RuntimeException(e);
      }
     }
    }
   }
  }

Monday, June 23, 2014

JPA/Hibernate single table inheritance

Here is a correct annotation configuration for the following scenario:
- abstract (mapped) super class (this means the super class is not an entity itself but inherited entites gets its fields)
- two or more subclasses

On the DB layer, we want a single table, so we use a discriminator column.

@Entity
@Inheritance
@DiscriminatorColumn(name="TYPE")
@Table(name="TABLE")
public abstract class AbstractEntity implements Serializable { ... }

@Entity
@DiscriminatorValue("TYPE1")
public class ConcreteEntity1 extends AbstractEntity { ... }

@Entity
@DiscriminatorValue("TYPE2")
public class ConcreteEntity2 extends AbstractEntity { ... }

Thursday, June 12, 2014

OpenJDK: Java SE reference implementation since Java SE 7

People.

The era of "nice but malfunctional/incomplete" OpenJDK and the "not so nice, but functional, usable and fast" Oracle JDK is end by the GA release of Java SE 7.
I know OpenJDK6 was not production ready (although I created production systems with that), but that's over.

If you need official verification, please read this announcement directly from Oracle: https://blogs.oracle.com/henrik/entry/moving_to_openjdk_as_the

OpenJDK 7 is the reference implementation. It actually is what you download from Oracle (plus some closed stuff like the installer itself, browser plugin and some other things not so important that I can't recall exactly, but please fix me in comments).
If you use Linux and need a JDK, just stick to the OpenJDK package. You don't need to add (wishfully) maintained PPAs, download binaries by hand and all the stuff. OpenJDK licensing conforms distribution with other software, so it is packaged (and security-maintained) just like all your other parts of the system.
I see a general confusion on this topic. Poor Oracle failed to spread this good news.

The same applies for Java SE 8 and all future releases.

Tuesday, June 10, 2014

LinkedIn

Everybody endorses me for PostgreSQL. Still, I don't know how they know.

Wednesday, June 4, 2014

Where is my Nexus 4 4.4.3 OTA file?

I know the full factory image is released, but I need the OTA file for sideload upgrade (or normal OTA, but even when Google launches OTA, the rollout doesn't include all devices at once, so most people have to wait a few days or even weeks).
The following devices are already got the OTA files or the OTA is in progress:

  • Nexus 5
  • One M7
  • One M8
  • Galaxy S4
  • Z Ultra
  • 2013 Wifi Nexus 7
This image of Khaleesi expresses my emotions now.


Tuesday, June 3, 2014

Android 4.4.3 factory images for Nexus devices

Android 4.4.3 has officially arrived. I don't know if the OTA rollout process also started. If you are eager, use the sideload method with the factory images found here: https://developers.google.com/android/nexus/images

Update: be cautious with the upgrade scripts, I wait for the incremental OTA files instead..