Confluex / Zuul

Keymaster and Gatekeeper - Application Configuration Management
http://confluex.com
Apache License 2.0
42 stars 32 forks source link

Add support for Oracle to the JPA entities #64

Open JStrittmatter opened 10 years ago

JStrittmatter commented 10 years ago

Currently when trying to use Oracle 11g as the Database you will receive a error during setup:

ORA-01400: cannot insert NULL into ("SECURITY_ROLE"."ID")

This is caused by oracle not using JPA Identity, Sequence Generators need to be used to support Oracle.

mcantrell commented 10 years ago

I think this might actually be related to the liquibase migrations which doesn't use JPA. Let me take a look and see what I can come up with. Unfortunately, I don't have an oracle database to test with.

JStrittmatter commented 10 years ago

I believe it is caused by the entities in the devnull-security jar dependency, the Role class in particular.

@Id @GeneratedValue(strategy = GenerationType.IDENTITY) Integer id

I'm not sure if there is a database agnostic way to handle this or not. Just ran into it when setting up a demo, H2 will work fine also for my needs.

JStrittmatter commented 10 years ago

Created a fork that will use JPA Table Generator to create ID's and updated liquidbase script to create table. Also had to make changes to the devnull.security jar to use the Table Generator on it's entities but have not created a fork for that yet.

mcantrell commented 10 years ago

OK, I was going to see if I could come up with a portable solution using GenerationType.AUTO and an optional sequence:

@Id
@GeneratedValue(strategy=GenerationType.AUTO, generator="my_entity_seq_gen")
@SequenceGenerator(name="my_entity_seq_gen", sequenceName="MY_ENTITY_SEQ")

If you want to submit a pull request, I'll take a look at it.

JStrittmatter commented 10 years ago

I submitted the pull request, it created as #67. I have also forked the devnull parent to make the changes to the security jar. Those changes are not necessary if LDAP or OPEN ID are used, but are needed it you want to run the demo profile with an oracle DB.

psmith commented 8 years ago

It's related to the liquibase scripts and/or jpa (depending on the oracle version). Both should be fixed.