OpenEJB and Database Views

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OpenEJB and Database Views

kenundrumz2100
Greetings all,

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.

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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

dblevins
Administrator

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

kenundrumz2100
Thanks for the reply David.

Could you supply a link to the mailing list you forwarded the question to so I can also track it and see what comes out of it? Or will that all show up here. Completely new to Nabble and not sure how it links / works it mailing lists.

Thanks a bunch!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

David Blevins-2

On Feb 10, 2011, at 11:29 AM, kenundrumz2100 wrote:

>
> Thanks for the reply David.
>
> Could you supply a link to the mailing list you forwarded the question to so
> I can also track it and see what comes out of it?
>
> Thanks a bunch!

No problem.  Here you go:

  http://openjpa.208410.n2.nabble.com/OpenJPA-Users-f208411.html
  http://openjpa.208410.n2.nabble.com/Re-OpenEJB-and-Database-Views-td6013082.html

-David

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Mark Struberg
In reply to this post by dblevins
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 <[hidden email]> wrote:

> From: David Blevins <[hidden email]>
> Subject: Re: OpenEJB and Database Views
> To: [hidden email]
> Cc: [hidden email]
> 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
>
>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

kenundrumz2100
Hey Mark,

Thanks for the reply.

We do not use maven for our builds.

Also, we actually currently are doing the creation of the tables manually with the old fashioned SQL files like you talked about, but because we are still in a development stage we really don't want to add one more level of complexity to the steps. In this case, we don't want to have to alter the SQL scripts every time we want to add or remove or change a name of a variable, especially when the deployment container (in our case JBoss) will do that for us for free. It's just the OpenEJB mocked out container that has a problem dealing with the views. We really were hoping that the SyncronizeMappings class would have a parameter that would deal with this easily, or at least easier than we are having right now. I imagine we are not the first people to want to map views to entity beans, and i would like to hope someone out there has done something to unit test them together in a fashion.

While we are open to the idea of SQL files if that is the only option, it just defiantly is not the best option, especially with how many tables we will be having at the end of the development cycle.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Thiago Veronezi
Hi,
You can try it by changing the JPA implementation from openjpa to
hibernate.
I think jboss uses hibernate as default, so I believe you can get the
same behavior by using it too.

*****************************************************
<!-- pom.xml -->
<dependency> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version> </dependency> <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId> <version>4.1.0.Final</version>
</dependency>

<repository>
<id>jboss-public</id>
<name>jboss-public</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
*************************************************
<!-- persistence.xml -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">

<persistence-unit name="embeddedPU">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>myDatabase</jta-data-source>
<non-jta-data-source>myDatabaseUnmanaged</non-jta-data-source>

<properties>
<!-- OPENJPA -->
<!-- property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/ -->
<!-- property name="openjpa.Log" value="SQL=TRACE"/ -->

<!-- HIBERNATE -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
</persistence>



[]s,
Thiago.

On Fri, Feb 11, 2011 at 8:57 AM, kenundrumz2100 <[hidden email]>wrote:

>
> Hey Mark,
>
> Thanks for the reply.
>
> We do not use maven for our builds.
>
> Also, we actually currently are doing the creation of the tables manually
> with the old fashioned SQL files like you talked about, but because we are
> still in a development stage we really don't want to add one more level of
> complexity to the steps. In this case, we don't want to have to alter the
> SQL scripts every time we want to add or remove or change a name of a
> variable, especially when the deployment container (in our case JBoss) will
> do that for us for free. It's just the OpenEJB mocked out container that
> has
> a problem dealing with the views. We really were hoping that the
> SyncronizeMappings class would have a parameter that would deal with this
> easily, or at least easier than we are having right now. I imagine we are
> not the first people to want to map views to entity beans, and i would like
> to hope someone out there has done something to unit test them together in
> a
> fashion.
>
> While we are open to the idea of SQL files if that is the only option, it
> just defiantly is not the best option, especially with how many tables we
> will be having at the end of the development cycle.
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-and-Database-Views-tp3299801p3301314.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

kenundrumz2100
Hello Thiago, thanks for the reply. We took what you had and tried it again. We once before did use Hibernate and got the following error, both with what we did before and after doing what you suggested.

/********************/
INFO - PersistenceUnit(name=myPersist, provider=org.hibernate.ejb.HibernatePersistence) - provider time 1197ms
INFO - Undeploying app: classpath.ear
ERROR - Unable to clear Sun JarFileFactory cache
java.net.URISyntaxException: Illegal character in path at index 31: file:///C:/Applications/MyApp/MyApp-ejb/lib/test/openejb-core-3.1.4.jar
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
        at java.net.URI$Parser.parse(URI.java:3014)
        at java.net.URI.<init>(URI.java:578)
        at org.apache.openejb.ClassLoaderUtil.clearSunJarFileFactoryCache(ClassLoaderUtil.java:178)
        at org.apache.openejb.ClassLoaderUtil.destroyClassLoader(ClassLoaderUtil.java:131)
        at org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:931)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:674)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
        at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
        at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
        at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
        at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
        at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
ERROR - Application could not be deployed:  classpath.ear
org.apache.openejb.OpenEJBException: Creating application failed: classpath.ear: org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent: @Column(s) not allowed on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:679)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
        at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
        at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
        at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
        at org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
        at org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: org.apache.openejb.OpenEJBException: org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent: @Column(s) not allowed on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:495)
        ... 40 more
Caused by: org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
        at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1345)
        at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:754)
        at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
        at org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:186)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:490)
        ... 40 more
/*********************/



And for reference, here is a broken down version of the Systems class it is breaking on.



/********************/

@Entity
@Table(name="MyApp_Systems")
public class Systems implements Serializable {
    /**
     * Primary key id.
     */            
    private String id;
    /**
     * The System object that is the parent of the System.
     */
    private Systems parent;

    /**
     * Default constructor for the <code>Systems</code> object.
     */
    public Systems() {
    }

    /**
     * Method used to get the primary id of the System.
     * @return the primary id value
     */
    @Id
    public String getId() {
        return id;
    }

    /**
     * Method used to get the parent System of the System.
     * @return the parent <code>Systems</code> object, or <code>null</code> if
     * no parent exists
     */
    @ManyToOne
    @Column(name="parentId")
    public Systems getParent() {
        return parent;
    }
}

/********************/


Thoughts? Much appreciated all again!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Thiago Veronezi
Hi,
Could you try it again with another openejb version?

3.2-SNAPSHOT

tkx,
Thiago.

On Fri, Feb 11, 2011 at 9:57 AM, kenundrumz2100 <[hidden email]>wrote:

>
> Hello Thiago, thanks for the reply. We took what you had and tried it
> again.
> We once before did use Hibernate and got the following error, both with
> what
> we did before and after doing what you suggested.
>
> /********************/
> INFO - PersistenceUnit(name=myPersist,
> provider=org.hibernate.ejb.HibernatePersistence) - provider time 1197ms
> INFO - Undeploying app: classpath.ear
> ERROR - Unable to clear Sun JarFileFactory cache
> java.net.URISyntaxException: Illegal character in path at index 31:
> file:///C:/Applications/MyApp/MyApp-ejb/lib/test/openejb-core-3.1.4.jar
>        at java.net.URI$Parser.fail(URI.java:2809)
>        at java.net.URI$Parser.checkChars(URI.java:2982)
>        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
>        at java.net.URI$Parser.parse(URI.java:3014)
>        at java.net.URI.<init>(URI.java:578)
>        at
>
> org.apache.openejb.ClassLoaderUtil.clearSunJarFileFactoryCache(ClassLoaderUtil.java:178)
>        at
>
> org.apache.openejb.ClassLoaderUtil.destroyClassLoader(ClassLoaderUtil.java:131)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:931)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:674)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
>        at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>        at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>        at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>        at javax.naming.InitialContext.init(InitialContext.java:223)
>        at javax.naming.InitialContext.<init>(InitialContext.java:197)
>        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>        at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>        at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>        at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
> ERROR - Application could not be deployed:  classpath.ear
> org.apache.openejb.OpenEJBException: Creating application failed:
> classpath.ear: org.hibernate.AnnotationException: @Column(s) not allowed on
> a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent: @Column(s)
> not allowed on a @ManyToOne property:
> com.myapp.ejb.entity.view.Systems.parent
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:679)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
>        at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>        at
>
> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>        at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>        at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>        at javax.naming.InitialContext.init(InitialContext.java:223)
>        at javax.naming.InitialContext.<init>(InitialContext.java:197)
>        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
>
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>        at
>
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>        at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>        at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>        at
>
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
>        at
>
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
> Caused by: org.apache.openejb.OpenEJBException:
> org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne
> property: com.myapp.ejb.entity.view.Systems.parent: @Column(s) not allowed
> on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:495)
>        ... 40 more
> Caused by: org.hibernate.AnnotationException: @Column(s) not allowed on a
> @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
>        at
>
> org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1345)
>        at
> org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:754)
>        at
>
> org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
>        at
>
> org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
>        at
> org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
>        at
>
> org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
>        at
>
> org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
>        at
> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
>        at
> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
>        at
>
> org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
>        at
>
> org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:186)
>        at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:490)
>        ... 40 more
> /*********************/
>
>
>
> And for reference, here is a broken down version of the Systems class it is
> breaking on.
>
>
>
> /********************/
>
> @Entity
> @Table(name="MyApp_Systems")
> public class Systems implements Serializable {
>    /**
>     * Primary key id.
>     */
>    private String id;
>    /**
>     * The System object that is the parent of the System.
>     */
>    private Systems parent;
>
>    /**
>     * Default constructor for the <code>Systems</code> object.
>     */
>    public Systems() {
>    }
>
>    /**
>     * Method used to get the primary id of the System.
>     * @return the primary id value
>     */
>    @Id
>    public String getId() {
>        return id;
>    }
>
>    /**
>     * Method used to get the parent System of the System.
>     * @return the parent <code>Systems</code> object, or <code>null</code>
> if
>     * no parent exists
>     */
>    @ManyToOne
>    @Column(name="parentId")
>    public Systems getParent() {
>        return parent;
>    }
> }
>
> /********************/
>
>
> Thoughts? Much appreciated all again!
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-and-Database-Views-tp3299801p3301402.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Thiago Veronezi
To be able to use "3.2-SNAPSHOT" I believe you need to add a new
repository...

<repository>
<id>apache-snapshots</id>
<url>http://repository.sonatype.org/content/repositories/apache-snapshots/
</url>
</repository>

[]s,
Thiago.


On Fri, Feb 11, 2011 at 10:08 AM, Thiago Veronezi <[hidden email]>wrote:

> Hi,
> Could you try it again with another openejb version?
>
> 3.2-SNAPSHOT
>
> tkx,
> Thiago.
>
> On Fri, Feb 11, 2011 at 9:57 AM, kenundrumz2100 <[hidden email]>wrote:
>
>>
>> Hello Thiago, thanks for the reply. We took what you had and tried it
>> again.
>> We once before did use Hibernate and got the following error, both with
>> what
>> we did before and after doing what you suggested.
>>
>> /********************/
>> INFO - PersistenceUnit(name=myPersist,
>> provider=org.hibernate.ejb.HibernatePersistence) - provider time 1197ms
>> INFO - Undeploying app: classpath.ear
>> ERROR - Unable to clear Sun JarFileFactory cache
>> java.net.URISyntaxException: Illegal character in path at index 31:
>> file:///C:/Applications/MyApp/MyApp-ejb/lib/test/openejb-core-3.1.4.jar
>>        at java.net.URI$Parser.fail(URI.java:2809)
>>        at java.net.URI$Parser.checkChars(URI.java:2982)
>>        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
>>        at java.net.URI$Parser.parse(URI.java:3014)
>>        at java.net.URI.<init>(URI.java:578)
>>        at
>>
>> org.apache.openejb.ClassLoaderUtil.clearSunJarFileFactoryCache(ClassLoaderUtil.java:178)
>>        at
>>
>> org.apache.openejb.ClassLoaderUtil.destroyClassLoader(ClassLoaderUtil.java:131)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:931)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:674)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
>>        at
>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
>>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>>        at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>>        at
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>>        at javax.naming.InitialContext.init(InitialContext.java:223)
>>        at javax.naming.InitialContext.<init>(InitialContext.java:197)
>>        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>>
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>>        at
>>
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>        at
>>
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>>        at
>>
>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>>        at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>>        at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>>        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>>        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>>        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>>        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>>        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
>> ERROR - Application could not be deployed:  classpath.ear
>> org.apache.openejb.OpenEJBException: Creating application failed:
>> classpath.ear: org.hibernate.AnnotationException: @Column(s) not allowed
>> on
>> a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent:
>> @Column(s)
>> not allowed on a @ManyToOne property:
>> com.myapp.ejb.entity.view.Systems.parent
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:679)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:450)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:368)
>>        at
>> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
>>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
>>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
>>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
>>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
>>        at
>>
>> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
>>        at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>>        at
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>>        at javax.naming.InitialContext.init(InitialContext.java:223)
>>        at javax.naming.InitialContext.<init>(InitialContext.java:197)
>>        at com.myapp.ejb.session.MyAppTestCase.setUp(MyAppTestCase.java:64)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>>
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>>        at
>>
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>        at
>>
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>>        at
>>
>> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>>        at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>>        at
>>
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>>        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>>        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>>        at
>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>>        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>>        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>>        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
>>        at
>>
>> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
>> Caused by: org.apache.openejb.OpenEJBException:
>> org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne
>> property: com.myapp.ejb.entity.view.Systems.parent: @Column(s) not allowed
>> on a @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:495)
>>        ... 40 more
>> Caused by: org.hibernate.AnnotationException: @Column(s) not allowed on a
>> @ManyToOne property: com.myapp.ejb.entity.view.Systems.parent
>>        at
>>
>> org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1345)
>>        at
>> org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:754)
>>        at
>>
>> org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
>>        at
>>
>> org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
>>        at
>> org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
>>        at
>>
>> org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
>>        at
>>
>> org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
>>        at
>> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
>>        at
>> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
>>        at
>>
>> org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
>>        at
>>
>> org.apache.openejb.assembler.classic.PersistenceBuilder.createEntityManagerFactory(PersistenceBuilder.java:186)
>>        at
>>
>> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:490)
>>        ... 40 more
>> /*********************/
>>
>>
>>
>> And for reference, here is a broken down version of the Systems class it
>> is
>> breaking on.
>>
>>
>>
>> /********************/
>>
>> @Entity
>> @Table(name="MyApp_Systems")
>> public class Systems implements Serializable {
>>    /**
>>     * Primary key id.
>>     */
>>    private String id;
>>    /**
>>     * The System object that is the parent of the System.
>>     */
>>    private Systems parent;
>>
>>    /**
>>     * Default constructor for the <code>Systems</code> object.
>>     */
>>    public Systems() {
>>    }
>>
>>    /**
>>     * Method used to get the primary id of the System.
>>     * @return the primary id value
>>     */
>>    @Id
>>    public String getId() {
>>        return id;
>>    }
>>
>>    /**
>>     * Method used to get the parent System of the System.
>>     * @return the parent <code>Systems</code> object, or <code>null</code>
>> if
>>     * no parent exists
>>     */
>>    @ManyToOne
>>    @Column(name="parentId")
>>    public Systems getParent() {
>>        return parent;
>>    }
>> }
>>
>> /********************/
>>
>>
>> Thoughts? Much appreciated all again!
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/OpenEJB-and-Database-Views-tp3299801p3301402.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

kenundrumz2100
We don't use Maven so we only grabbed what binaries that were available on the OpenJEB website, which i think was only 3.1.4 currently. Is there a download for the binaries? Or do we need to use maven to grab it? Our main IDE is NetBeans, which only recently got Maven capabilities (at least that we have seen).

Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Thiago Veronezi
Hmmmm, Ok. Ill try it for you here.
I remember having a similar error ("java.net.URISyntaxException: Illegal
character in path at index") some time ago. I need to check. Ill get back to
you when I find something.

[]s,
Thiago.

ps.: Give Maven a try... It will make you life way easier! :O)


On Fri, Feb 11, 2011 at 11:15 AM, kenundrumz2100
<[hidden email]>wrote:

>
> We don't use Maven so we only grabbed what binaries that were available on
> the OpenJEB website, which i think was only 3.1.4 currently. Is there a
> download for the binaries? Or do we need to use maven to grab it? Our main
> IDE is NetBeans, which only recently got Maven capabilities (at least that
> we have seen).
>
> Thanks!
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-and-Database-Views-tp3299801p3301426.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

kenundrumz2100
Thanks, I appreciate it. Hope it works, and if it does hopefully we can figure out a way to grab the newest version so we can run this.

I have used Maven in the past, and I don't object to it, just the project we are on right now doesn't use it, and NetBeans and Maven are still starting to get along.

Looking forward to hearing how it worked, let me know once you can! Thanks again!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Thiago Veronezi
Hi,
I didn't had time yet, but Ill check it this evening.
[]s,
Thiago.

On Mon, Feb 14, 2011 at 8:59 AM, kenundrumz2100 <[hidden email]>wrote:

>
> Thanks, I appreciate it. Hope it works, and if it does hopefully we can
> figure out a way to grab the newest version so we can run this.
>
> I have used Maven in the past, and I don't object to it, just the project
> we
> are on right now doesn't use it, and NetBeans and Maven are still starting
> to get along.
>
> Looking forward to hearing how it worked, let me know once you can! Thanks
> again!
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-and-Database-Views-tp3299801p3304930.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenEJB and Database Views

Michael Dick
In reply to this post by Mark Struberg
I've never seen SynchronizeMappings=buildSchema cause problems with existing
tables - but maybe I've just been lucky.

You could try the using add instead of buildSchema e.g. :

            <property name="openjpa.jdbc.SynchronizeMappings"
value="add(ForeignKeys=true)" />

This should ignore any existing schema elements.

Hope this helps,

-mike


On Thu, Feb 10, 2011 at 3:04 PM, Mark Struberg <[hidden email]> wrote:

> 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 <[hidden email]> wrote:
>
> > From: David Blevins <[hidden email]>
> > Subject: Re: OpenEJB and Database Views
> > To: [hidden email]
> > Cc: [hidden email]
> > 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
> >
> >
>
>
>
>
Loading...