You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Leonardo K. Shikida" <sh...@gmail.com> on 2015/07/08 16:55:57 UTC
JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Hi
is there any known bug related to this?
Sometimes, my web app generates the schema
<property
name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)" />
sometimes not.
Some sort of a heinsenbug. :-(
TIA
Leo
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
to not fix I mean :-)
[]
Leo
On Wed, Jul 8, 2015 at 6:50 PM, Leonardo K. Shikida <sh...@gmail.com>
wrote:
> Hi Mark
>
> Although I agree with you that automatic schema generation is not a good
> idea in production, I also believe there's no reason to fix something that
> has a bug...
>
> I have all the necessary rights. That's because it worked when I started
> tomee one webapp at a time.
>
> It seems to me that OpenJPA mapping tool just need some adjustment to work
> with more than one persistence context :-)
>
> TIA
>
> Leo
>
>
> []
>
> Leo
>
> On Wed, Jul 8, 2015 at 4:22 PM, Mark Struberg <st...@yahoo.de> wrote:
>
>> Hmm, never had this problem. Important for me to figure what goes wrong
>> in your case.
>>
>> As you already stated: the schema is aways the user which logs in. Is
>> there probably some login trigger which does an alter session to switch the
>> schema after logon to oracle? And do you have enough rights and can this
>> user really create the schema?
>>
>> You can use the openjpa-maven-plugin [1] to create the schema and
>> probably create it in the db with the sql-maven-plugin [2] or even use
>> flywaydb or liquibase. This is _much_ better for production anyway. The
>> code is exactly the same as in your case(OpenJPA MappingTool and SchemaTool
>> classes), but you SEE what you get.
>> Trust me, you do NOT want ANY JPA provider change your schema in
>> production - all this stuff is really only good for samples. Really, I do
>> not even use if for unit testing as I have no clue if the thing I unit test
>> is really the same thing as I have on the production servers later ;)
>>
>>
>> LieGrue,
>> strub
>>
>> [1]
>> https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L67
>> [2]
>> https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L30
>>
>>
>> > Am 08.07.2015 um 19:37 schrieb Leonardo K. Shikida <sh...@gmail.com>:
>> >
>> > two things that I've noticed
>> >
>> > [1] if during the entities creation, the sequence already exists,
>> openJPA
>> > tries to create it again and fails the whole process, so ensure that,
>> on a
>> > schema creation failure, no generated tables or sequences are there
>> >
>> > [2] starting tomee with 2 web apps, each one using its own resource.xml
>> to
>> > define the datasource for the persistence.xml, even if persistence.xml
>> has
>> > openjpa.jdbc.schema defined, openjpa still seems to mix things and fails
>> > (maybe I should enforce the schema somewhere else), so if I start tomee
>> > with one webapp first, it works, and then I can add other webapps one by
>> > one and restarting tomee... :-)
>> >
>> >
>> >
>> > []
>> >
>> > Leo
>> >
>> > On Wed, Jul 8, 2015 at 12:38 PM, Leonardo K. Shikida <shikida@gmail.com
>> >
>> > wrote:
>> >
>> >> Probably the same one I've saw once for dbunit, because schema and
>> users
>> >> are the same thing for oracle.
>> >>
>> >> I think I know what you're talking about.
>> >>
>> >> Gonna try that
>> >>
>> >> []
>> >>
>> >> Leo
>> >>
>> >> On Wed, Jul 8, 2015 at 12:28 PM, Romain Manni-Bucau <
>> rmannibucau@gmail.com
>> >>> wrote:
>> >>
>> >>> On the phone but can be an issue with schema selection if you have
>> >>> multiple
>> >>> schema. There is an option to force it.
>> >>> Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a
>> >>> écrit :
>> >>>
>> >>>> oracle 11 (not XE)
>> >>>>
>> >>>> []
>> >>>>
>> >>>> Leo
>> >>>>
>> >>>> On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
>> >>> rmannibucau@gmail.com
>> >>>>>
>> >>>> wrote:
>> >>>>
>> >>>>> Hi
>> >>>>>
>> >>>>> Which database?
>> >>>>> Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
>> >>>> écrit :
>> >>>>>
>> >>>>>> Hi
>> >>>>>>
>> >>>>>> is there any known bug related to this?
>> >>>>>>
>> >>>>>> Sometimes, my web app generates the schema
>> >>>>>>
>> >>>>>> <property
>> >>>>>> name="openjpa.jdbc.SynchronizeMappings"
>> >>>>>> value="buildSchema(ForeignKeys=true)" />
>> >>>>>>
>> >>>>>> sometimes not.
>> >>>>>>
>> >>>>>> Some sort of a heinsenbug. :-(
>> >>>>>>
>> >>>>>> TIA
>> >>>>>>
>> >>>>>> Leo
>> >>>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>
>> >>
>>
>>
>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
Hi Mark
Although I agree with you that automatic schema generation is not a good
idea in production, I also believe there's no reason to fix something that
has a bug...
I have all the necessary rights. That's because it worked when I started
tomee one webapp at a time.
It seems to me that OpenJPA mapping tool just need some adjustment to work
with more than one persistence context :-)
TIA
Leo
[]
Leo
On Wed, Jul 8, 2015 at 4:22 PM, Mark Struberg <st...@yahoo.de> wrote:
> Hmm, never had this problem. Important for me to figure what goes wrong in
> your case.
>
> As you already stated: the schema is aways the user which logs in. Is
> there probably some login trigger which does an alter session to switch the
> schema after logon to oracle? And do you have enough rights and can this
> user really create the schema?
>
> You can use the openjpa-maven-plugin [1] to create the schema and probably
> create it in the db with the sql-maven-plugin [2] or even use flywaydb or
> liquibase. This is _much_ better for production anyway. The code is exactly
> the same as in your case(OpenJPA MappingTool and SchemaTool classes), but
> you SEE what you get.
> Trust me, you do NOT want ANY JPA provider change your schema in
> production - all this stuff is really only good for samples. Really, I do
> not even use if for unit testing as I have no clue if the thing I unit test
> is really the same thing as I have on the production servers later ;)
>
>
> LieGrue,
> strub
>
> [1]
> https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L67
> [2]
> https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L30
>
>
> > Am 08.07.2015 um 19:37 schrieb Leonardo K. Shikida <sh...@gmail.com>:
> >
> > two things that I've noticed
> >
> > [1] if during the entities creation, the sequence already exists, openJPA
> > tries to create it again and fails the whole process, so ensure that, on
> a
> > schema creation failure, no generated tables or sequences are there
> >
> > [2] starting tomee with 2 web apps, each one using its own resource.xml
> to
> > define the datasource for the persistence.xml, even if persistence.xml
> has
> > openjpa.jdbc.schema defined, openjpa still seems to mix things and fails
> > (maybe I should enforce the schema somewhere else), so if I start tomee
> > with one webapp first, it works, and then I can add other webapps one by
> > one and restarting tomee... :-)
> >
> >
> >
> > []
> >
> > Leo
> >
> > On Wed, Jul 8, 2015 at 12:38 PM, Leonardo K. Shikida <sh...@gmail.com>
> > wrote:
> >
> >> Probably the same one I've saw once for dbunit, because schema and users
> >> are the same thing for oracle.
> >>
> >> I think I know what you're talking about.
> >>
> >> Gonna try that
> >>
> >> []
> >>
> >> Leo
> >>
> >> On Wed, Jul 8, 2015 at 12:28 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> >>> wrote:
> >>
> >>> On the phone but can be an issue with schema selection if you have
> >>> multiple
> >>> schema. There is an option to force it.
> >>> Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a
> >>> écrit :
> >>>
> >>>> oracle 11 (not XE)
> >>>>
> >>>> []
> >>>>
> >>>> Leo
> >>>>
> >>>> On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
> >>> rmannibucau@gmail.com
> >>>>>
> >>>> wrote:
> >>>>
> >>>>> Hi
> >>>>>
> >>>>> Which database?
> >>>>> Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
> >>>> écrit :
> >>>>>
> >>>>>> Hi
> >>>>>>
> >>>>>> is there any known bug related to this?
> >>>>>>
> >>>>>> Sometimes, my web app generates the schema
> >>>>>>
> >>>>>> <property
> >>>>>> name="openjpa.jdbc.SynchronizeMappings"
> >>>>>> value="buildSchema(ForeignKeys=true)" />
> >>>>>>
> >>>>>> sometimes not.
> >>>>>>
> >>>>>> Some sort of a heinsenbug. :-(
> >>>>>>
> >>>>>> TIA
> >>>>>>
> >>>>>> Leo
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
>
>
Re: JPA trying to alter table to add the single table discriminator before openJPA build the schema on tomee startup (1.6.0.2)
Posted by Mark Struberg <st...@yahoo.de>.
Hmm, never had this problem. Important for me to figure what goes wrong in your case.
As you already stated: the schema is aways the user which logs in. Is there probably some login trigger which does an alter session to switch the schema after logon to oracle? And do you have enough rights and can this user really create the schema?
You can use the openjpa-maven-plugin [1] to create the schema and probably create it in the db with the sql-maven-plugin [2] or even use flywaydb or liquibase. This is _much_ better for production anyway. The code is exactly the same as in your case(OpenJPA MappingTool and SchemaTool classes), but you SEE what you get.
Trust me, you do NOT want ANY JPA provider change your schema in production - all this stuff is really only good for samples. Really, I do not even use if for unit testing as I have no clue if the thing I unit test is really the same thing as I have on the production servers later ;)
LieGrue,
strub
[1] https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L67
[2] https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L30
> Am 08.07.2015 um 19:37 schrieb Leonardo K. Shikida <sh...@gmail.com>:
>
> two things that I've noticed
>
> [1] if during the entities creation, the sequence already exists, openJPA
> tries to create it again and fails the whole process, so ensure that, on a
> schema creation failure, no generated tables or sequences are there
>
> [2] starting tomee with 2 web apps, each one using its own resource.xml to
> define the datasource for the persistence.xml, even if persistence.xml has
> openjpa.jdbc.schema defined, openjpa still seems to mix things and fails
> (maybe I should enforce the schema somewhere else), so if I start tomee
> with one webapp first, it works, and then I can add other webapps one by
> one and restarting tomee... :-)
>
>
>
> []
>
> Leo
>
> On Wed, Jul 8, 2015 at 12:38 PM, Leonardo K. Shikida <sh...@gmail.com>
> wrote:
>
>> Probably the same one I've saw once for dbunit, because schema and users
>> are the same thing for oracle.
>>
>> I think I know what you're talking about.
>>
>> Gonna try that
>>
>> []
>>
>> Leo
>>
>> On Wed, Jul 8, 2015 at 12:28 PM, Romain Manni-Bucau <rmannibucau@gmail.com
>>> wrote:
>>
>>> On the phone but can be an issue with schema selection if you have
>>> multiple
>>> schema. There is an option to force it.
>>> Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a
>>> écrit :
>>>
>>>> oracle 11 (not XE)
>>>>
>>>> []
>>>>
>>>> Leo
>>>>
>>>> On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
>>> rmannibucau@gmail.com
>>>>>
>>>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> Which database?
>>>>> Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
>>>> écrit :
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> is there any known bug related to this?
>>>>>>
>>>>>> Sometimes, my web app generates the schema
>>>>>>
>>>>>> <property
>>>>>> name="openjpa.jdbc.SynchronizeMappings"
>>>>>> value="buildSchema(ForeignKeys=true)" />
>>>>>>
>>>>>> sometimes not.
>>>>>>
>>>>>> Some sort of a heinsenbug. :-(
>>>>>>
>>>>>> TIA
>>>>>>
>>>>>> Leo
>>>>>>
>>>>>
>>>>
>>>
>>
>>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
two things that I've noticed
[1] if during the entities creation, the sequence already exists, openJPA
tries to create it again and fails the whole process, so ensure that, on a
schema creation failure, no generated tables or sequences are there
[2] starting tomee with 2 web apps, each one using its own resource.xml to
define the datasource for the persistence.xml, even if persistence.xml has
openjpa.jdbc.schema defined, openjpa still seems to mix things and fails
(maybe I should enforce the schema somewhere else), so if I start tomee
with one webapp first, it works, and then I can add other webapps one by
one and restarting tomee... :-)
[]
Leo
On Wed, Jul 8, 2015 at 12:38 PM, Leonardo K. Shikida <sh...@gmail.com>
wrote:
> Probably the same one I've saw once for dbunit, because schema and users
> are the same thing for oracle.
>
> I think I know what you're talking about.
>
> Gonna try that
>
> []
>
> Leo
>
> On Wed, Jul 8, 2015 at 12:28 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> > wrote:
>
>> On the phone but can be an issue with schema selection if you have
>> multiple
>> schema. There is an option to force it.
>> Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a
>> écrit :
>>
>> > oracle 11 (not XE)
>> >
>> > []
>> >
>> > Leo
>> >
>> > On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
>> rmannibucau@gmail.com
>> > >
>> > wrote:
>> >
>> > > Hi
>> > >
>> > > Which database?
>> > > Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
>> > écrit :
>> > >
>> > > > Hi
>> > > >
>> > > > is there any known bug related to this?
>> > > >
>> > > > Sometimes, my web app generates the schema
>> > > >
>> > > > <property
>> > > > name="openjpa.jdbc.SynchronizeMappings"
>> > > > value="buildSchema(ForeignKeys=true)" />
>> > > >
>> > > > sometimes not.
>> > > >
>> > > > Some sort of a heinsenbug. :-(
>> > > >
>> > > > TIA
>> > > >
>> > > > Leo
>> > > >
>> > >
>> >
>>
>
>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
Probably the same one I've saw once for dbunit, because schema and users
are the same thing for oracle.
I think I know what you're talking about.
Gonna try that
[]
Leo
On Wed, Jul 8, 2015 at 12:28 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> On the phone but can be an issue with schema selection if you have multiple
> schema. There is an option to force it.
> Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a écrit
> :
>
> > oracle 11 (not XE)
> >
> > []
> >
> > Leo
> >
> > On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > Hi
> > >
> > > Which database?
> > > Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
> > écrit :
> > >
> > > > Hi
> > > >
> > > > is there any known bug related to this?
> > > >
> > > > Sometimes, my web app generates the schema
> > > >
> > > > <property
> > > > name="openjpa.jdbc.SynchronizeMappings"
> > > > value="buildSchema(ForeignKeys=true)" />
> > > >
> > > > sometimes not.
> > > >
> > > > Some sort of a heinsenbug. :-(
> > > >
> > > > TIA
> > > >
> > > > Leo
> > > >
> > >
> >
>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by Romain Manni-Bucau <rm...@gmail.com>.
On the phone but can be an issue with schema selection if you have multiple
schema. There is an option to force it.
Le 8 juil. 2015 08:17, "Leonardo K. Shikida" <sh...@gmail.com> a écrit :
> oracle 11 (not XE)
>
> []
>
> Leo
>
> On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Hi
> >
> > Which database?
> > Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a
> écrit :
> >
> > > Hi
> > >
> > > is there any known bug related to this?
> > >
> > > Sometimes, my web app generates the schema
> > >
> > > <property
> > > name="openjpa.jdbc.SynchronizeMappings"
> > > value="buildSchema(ForeignKeys=true)" />
> > >
> > > sometimes not.
> > >
> > > Some sort of a heinsenbug. :-(
> > >
> > > TIA
> > >
> > > Leo
> > >
> >
>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
oracle 11 (not XE)
[]
Leo
On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> Hi
>
> Which database?
> Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a écrit :
>
> > Hi
> >
> > is there any known bug related to this?
> >
> > Sometimes, my web app generates the schema
> >
> > <property
> > name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema(ForeignKeys=true)" />
> >
> > sometimes not.
> >
> > Some sort of a heinsenbug. :-(
> >
> > TIA
> >
> > Leo
> >
>
Re: JPA trying to alter table to add the single table discriminator
before openJPA build the schema on tomee startup (1.6.0.2)
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
Which database?
Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <sh...@gmail.com> a écrit :
> Hi
>
> is there any known bug related to this?
>
> Sometimes, my web app generates the schema
>
> <property
> name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" />
>
> sometimes not.
>
> Some sort of a heinsenbug. :-(
>
> TIA
>
> Leo
>