openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: OpenEJB and Database Views
Date Thu, 10 Feb 2011 21:04:21 GMT
Hi David!

If all options break, then you can always go the 'manual way' by generating the sql upfront.

kenundrumz2100, do you use maven for your build? In this case you can use the openjpa:sql
goal of the openjpa-maven-plugin in conjunction with the sql-maven-plugin.

I usually use the following scripts in my projects

src/main/sql/
├── mysql
│   ├── createdb.sql     <- drops and freshly creates the database
│   ├── database.sql     <- contains the creat tables statements
│   ├── createindex.sql  <- manually maintained additional indexes
│   └── schema_delta.sql <- see (*a)
└── oracle
    ├── createdb.sql
    ├── createindex.sql
    ├── database.sql
    └── schema_delta.sql
src/test/sql/
├── mysql
│   ├── migrationdata.sql <- parts of anonymized data from a prod system
│   └── testdata.sql      <- static test data for unit tests
└── oracle
    └── testdata.sql 


(*a) once a project went productive, we switch from the sql action 'build' to 'refresh' thus
only generating ALTER TABLE statments. We copy those to the bottom of the schema_delta.sql
file and add revision information. This way we can fairly easy upgrade the databases of various
installations.



Feel free to post back if you need more help.

LieGrue,
strub

------
Posted via my mobile phone because my UPC connection sucks big times since a few weeks...


--- On Thu, 2/10/11, David Blevins <david.blevins@visi.com> wrote:

> From: David Blevins <david.blevins@visi.com>
> Subject: Re: OpenEJB and Database Views
> To: users@openjpa.apache.org
> Cc: users@openejb.apache.org
> Date: Thursday, February 10, 2011, 7:22 PM
> 
> On Feb 10, 2011, at 10:40 AM, kenundrumz2100 wrote:
> 
> > I am a relatively new user of OpenEJB, and first wanna
> say it seems like a
> > great start towards being able to finally unit test
> out session bean's out
> > of container.
> 
> Thanks!
> 
> > I am, however, have a small issue that I am not
> entirely sure how to
> > overcome. My project I am on uses 5 view tables, 4
> mapped to entity beans
> > and 1 as a join table between 2 of the ones mentioned
> before. Based upon the
> > simple examples I have seen off of the primary
> website, I get an error
> > whenever I attempt to run the unit tests and include
> the following in my
> > persistence.xml file (apologize if there are code tags
> on here, i didn't see
> > them):
> > 
> > <properties>
> >      <property
> name="openjpa.jdbc.SynchronizeMappings"
> > value="buildSchema(ForeignKeys=true)"/> 
>   </properties>
> > 
> > Essentially, it is attempting to build the view
> tables, which obviously it
> > can not do since they already exist. We do need to be
> able to build all the
> > other non-view tables, but are coming up empty on
> figuring out how to go
> > about this. I also have no idea what the buildSchema
> method is, or if it
> > takes other parameters for such an occasion like this.
> Any assistance anyone
> > can give is welcome. I will try anything at least
> twice! If you need any
> > additional information, I will supply what I can.
> > 
> > Thanks ahead of time!
> 
> Reposting to the OpenJPA list as I'm not entirely sure of
> the breadth of options available for the SynchronizeMappings
> functionality.  FYI to the OpenJPA devs, we use 1.2.x
> in the current OpenEJB release.
> 
> 
> -David
> 
> 


      

Mime
View raw message