Skip to content

Instantly share code, notes, and snippets.

@mrotteveel
Last active January 13, 2017 15:05
Show Gist options
  • Save mrotteveel/273aa9e836880211820f54ff21164ec1 to your computer and use it in GitHub Desktop.
Save mrotteveel/273aa9e836880211820f54ff21164ec1 to your computer and use it in GitHub Desktop.
Example of decoding UUID with eclipselink and Firebird/Jaybird
CREATE TABLE TODO
(
ID char(16) CHARACTER SET OCTETS NOT NULL,
CONSTRAINT PK_TODO PRIMARY KEY (ID)
);
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="todos" transaction-type="RESOURCE_LOCAL">
<class>nl.lawinegevaar.eclipselink.entity.Todo</class>
<class>nl.lawinegevaar.eclipselink.converter.UUIDAttributeConverter</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.firebirdsql.jdbc.FBDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:firebirdsql://localhost/d:/data/db/fb3/eclipselink.fdb?charSet=UTF-8&amp;octetsAsBytes=true" />
<property name="javax.persistence.jdbc.user" value="sysdba" />
<property name="javax.persistence.jdbc.password" value="masterkey" />
<!-- EclipseLink should create the database schema automatically -->
<!--<property name="eclipselink.ddl-generation" value="create-tables" />-->
<!--<property name="eclipselink.ddl-generation.output-mode" value="database" />-->
</properties>
</persistence-unit>
</persistence>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nl.lawinegevaar</groupId>
<artifactId>eclipselink</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>org.firebirdsql.jdbc</groupId>
<artifactId>jaybird-jdk18</artifactId>
<version>2.2.12</version>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment