How to find a Vertica database last good epoch ?

If you need to check if your Vertica ROS is lagging behind your WOS, you can use the following query to retrieve the last good epoch (i.e : the last one written to disk, which ensures you won’t lose any data even in the case of a catastrophic failure where all your nodes would shut down simultaneously) :

SELECT epoch_number, epoch_close_time 
	FROM v_monitor.system 
		JOIN epochs dbadmin ON epoch_number = last_good_epoch; 

How to digitally sign your outgoing emails with Outlook ?

Would you like to prove to your contacts the authenticity of your emails ? A S/MIME signature of your messages may be a solution. It will guarantee that a message comes from you, and that its content wasn’t altered. You can do it for free – as long as it’s for a personnal use – using a Comodo free email certificate. The solution may be seducing, but there are two caveats.

First, the validation of your signature is done by your recipient email client, and most email clients just don’t support it. As a rule of thumb, consider only the outlook desktop app supports it (gmail, outlook.com, default android client don’t support it, iphone can support it but it’s disabled by default). And there’s nothing you can do about it.

Second, the procedure to sign your messages may give some headaches, and it’ll be different for each email client. But at least, here is a step by step guide to digitally sign outgoing messages on Outlook.

  1. Get a mail Certificate
  2. Install your mail certificate in your local certificate store
  3. Check that your certificate is properly installed
  4. Configure Outlook to sign outgoing messages

1. Get a mail certificate

If you don’t already own a mail certificate, you can get a free one from Comodo here, or directly here.
Continue reading

Named parameter not found in JPA/Hibernate native SQL queries

When using named parameters in native SQL queries with Hibernate implementation of the Java Persistence API (JPA), you may run into the following error

org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that name [orderId] did not exist; 
nested exception is java.lang.IllegalArgumentException: Parameter with that name [orderId] did not exist

This happens even if the named parameter was properly set, as in the following example :

For example :

void update(EntityManager em) {
    Query q = em.createNativeQuery("SELECT * FROM orders where id = :orderId;");
    q.setParameter("orderId", "1234");
    q.executeUpdate();
}

The issue comes from Continue reading

Solving Eclipse/maven error : dependency/ a.b.c (managed from x.y.z)

If Eclipse/M2E reports a maven dependency version conflict, with message “managed from x.y.z” (ex : “jooq/ 3.7.1 (managed from 3.6.0)“), the conflicting dependency is defined by an ancestor of the current maven project (could be its parent, great-parent, great-great-parent, etc.).

For example, let’s say maven signals a dependency conflict for a spring-boot 1.3 application. Version 3.7.1 of the JOOQ library is used while you specified version 3.6.0 (which is a pain because JAVA 7 is targeted, while JOOQ 3.7.1 only supports JAVA 8).

The error returned by the SpringBoot application is :

java.lang.UnsupportedClassVersionError: org/jooq/SQLDialect : 
    Unsupported major.minor version 52.0

JOOQ is used by a dependency of the spring-boot application. The main application itself has no reference to JOOQ.

Indeed :

  1. project A declares a maven dependency on JOOQ 3.6.0 :

    <dependency>
        <groupId>org.jooq</groupId>
        <artifactId>jooq</artifactId>
        <version>3.6.0</version>
    </dependency>
    

    datawarehouse-jooq-dependency

  2. project B declares a maven dependency on project A, and defines spring-boot-starter-parent as a parent
    In project B dependencies, Eclipse/M2E flags JOOQ as “version 3.7.1 (managed from 3.6.0)” while version 3.6.0 is expected.
    feedbackrestservices-jooq-dependecy
  3. spring-boot-starter-parent has spring-boot-dependencies as a parent, which itself manages dependencies for JOOQ
    spring-boot-dependencies-managed-dependencies-jooq

    <dependency>
        <groupId>org.jooq</groupId>
        <artifactId>jooq</artifactId>
        <version>${jooq.version}</version>
    </dependency>
    

To fix it, you could add a jooq 3.6.0 dependency to project B, so that the maven dependency conflict solving strategy uses this version since it is the nearest dependency. But that would be ugly. A cleaner solution consists in overriding the jooq.version property defined in spring-boot-starter-parent, as documented here :

<properties>
    <jooq.version>3.6.0</jooq.version>
</properties>