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 <[email protected]>:
> 
> 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 <[email protected]>
> 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 <[email protected]
>>> 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" <[email protected]> a
>>> écrit :
>>> 
>>>> oracle 11 (not XE)
>>>> 
>>>> []
>>>> 
>>>> Leo
>>>> 
>>>> On Wed, Jul 8, 2015 at 12:07 PM, Romain Manni-Bucau <
>>> [email protected]
>>>>> 
>>>> wrote:
>>>> 
>>>>> Hi
>>>>> 
>>>>> Which database?
>>>>> Le 8 juil. 2015 07:56, "Leonardo K. Shikida" <[email protected]> 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
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>> 

Reply via email to