This is what happened:

The OpenJPA implementation is in the Geronimo container.  Something within the 
container is explicitly telling OpenJPA to synchronize the database objects 
(openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true)).  I tried 
going into the Geronimo config and changing this to 
openjpa.jdbc.SynchronizeMappings=validate.  This still did not work as it was 
still trying to synchronize schema.  I then went into the persistence.xml and 
explicitly added the property <property name="openjpa.jdbc.SynchronizeMappings" 
value="validate"/>.  From then on, everything worked the way it should.    


Russell Collins
Sr. Software Engineer
McLane Advanced Technology

"Do or do not, there is no try." - Yoda

-----Original Message-----
From: Kevin Sutter [mailto:kwsut...@gmail.com] 
Sent: Thursday, July 23, 2009 8:04 AM
To: users@openjpa.apache.org
Subject: Re: JPA issue

Hi Russell,

On Wed, Jul 22, 2009 at 11:13 PM, Russell Collins <
russell.coll...@mclaneat.com> wrote:

> I am having a problem that I believe is associated with the JPA module.  I
> have created some entity objects and EJB's.  When I run through the
> continuous build process, it deploys the objects to Geronimo (where OpenJPA
> is the persistence layer).   The first time I try to access the object, the
> very first test fails and the remainder of the tests continue without a
> problem.  When I re-run the failing test without first deploying, it runs
> successfully without a problem.  When I look at the log this is what I see
> that it is trying to do:
>
> 15897:  2009-07-22 22:39:24,419 ERROR [root] Error in EntityEmds -
> <openjpa-1.2.1-r752877:753278 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: Syntax error or access
> violation message from server: "Access denied for user 'emdsuser'@'%' to
> database 'emds'" {stmnt 9914713 CREATE TABLE OPENJPASEQ (ID TINYINT NOT
> NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID)) TYPE = innodb} [code=1044,
> state=42000]
>
> 15898:  2009-07-22 22:39:24,419 ERROR [root] <openjpa-1.2.1-r752877:753278
> nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
> Syntax error or access violation message from server: "Access denied for
> user 'emdsuser'@'%' to database 'emds'" {stmnt 9914713 CREATE TABLE
> OPENJPASEQ (ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID))
> TYPE = innodb} [code=1044, state=42000]
>
> 15899:  2009-07-22 22:39:24,419 ERROR [root] <openjpa-1.2.1-r752877:753278
> nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
> Syntax error or access violation message from server: "Access denied for
> user 'emdsuser'@'%' to database 'emds'" {stmnt 9914713 CREATE TABLE
> OPENJPASEQ (ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID))
> TYPE = innodb} [code=1044, state=42000]
>
> 16062:  2009-07-22 22:39:37,731 DEBUG [AuthenticatorBase] Security checking
> request GET
> /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/C:0xbgeronimo20x210x240x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_formId/-7251884905713739289/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/WARN/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/100
>
>
> A couple of observations.
>
> 1.    emdsuser has access to the database.  The other ejb runs use the same
> userid without any problem.  The user does not have the ability to create
> tables.  The can only do crud activities
>
> 2.    why is OpenJPA trying to create this table (OPENJPASEQ)?  I do not
> know where this comes from and I did not tell it to do that.


Are you using id generation with @GeneratedValue?  I believe the default for
OpenJPA is to use a sequence table.  But, I thought the default name for the
table was OPENJPA_SEQUENCE_TABLE.  Maybe due to size restrictions, we
shorten it for certain databases and configurations.

Scan your code.  If you are not using @GeneratedValue (or the xml
equivalent), then there should be no reason for OpenJPA to be creating the
table.

If you are using @GeneratedValue, but do not wish to use a separate table,
you might see if IDENTITY or SEQUENCE generators would work better for you.
Most databases support IDENTITY, not all support SEQUENCE.

Kevin


>
>
> Any help that you could give me would be greatly appreciated.
>
>
>

Reply via email to