Skip to content

Instantly share code, notes, and snippets.

@mlecoutre
mlecoutre / designer.html
Last active August 29, 2015 14:12
designer
<link href="../polymer/polymer.html" rel="import">
<polymer-element name="name-tag">
<template>
<style>
</style>
<b>{{ owner }}</b>
</template>
@mlecoutre
mlecoutre / gist:4088178
Created November 16, 2012 15:25
JPA on Heroku without Spring

When creating a DEV instance of postgreSQL on heroku, heroku create an environment variable named "DATABASE_URL" that contains url, user and password. As we are in a cloud environment, your persistence.xml file should not contain any reference to a specific host, port or user/password account. It can change without any warning.

Unfortunately, this variable is not compliant with the JDBC format because HEROKU is not done just for the JAVA. So we need to translate this generic URL into a valid JDBC URL and extract user password You can found on the web a good example with Spring, but i've not found anything without it.

So here is a snippet of code that you can use in a ServletContextListener to initialize the EntityManagerFactory. (you will found it in org.mat.nounou.servlets.EntityManagerLoaderListener in this application).