-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Database Schema validation
PostPosted: Thu Feb 16, 2012 2:43 pm 
Newbie

Joined: Mon Oct 01, 2007 9:14 am
Posts: 6
Location: Virginia
I'm am using a combination of Hibernate libraries and Java Entities to access my database, and I am having some strange problems. I hope someone can point me in the right direction....

My development environment is Eclipse (but I'm relatively new to Eclipse so I may be doing some things wrong with that too...) and Vaadin.

Most of my programs work fine. I have generated JPA classes from my database tables, and Eclipse creates a 'persistence.xml' file. And it mostly works. The problem is that the persistence.xml file looks something like this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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">
   <persistence-unit name="VRSN_Entities" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <class>com.vrsn.Graph</class>
      ..... more class definitions here....
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost:<port><database>"/>
         <property name="hibernate.connection.username" value="dbUser"/>
         <property name="hibernate.connection.password" value="dbPassword"/>
      </properties>
   </persistence-unit>
</persistence>


This works fine until I deploy it to a system where outgoing Port 80 requests are blocked (security policy). Then the system hangs trying to get to xmlns="http://java.sun.com/xml/ns/persistence" etc.

So I tried changing that line in persistence.xml to just this:

<persistence version="2.0">

Now every other time that I compile this library, Eclipse gives me an error that says that persistence.xml does not have a valid format. But if I delete the error and recompile, it works. And when I include this library in a web project, it also works - most of the time.... The really strange problem is that I have 2 web programs with identical login screens (as far as I know). One calls the database to get a user record and it works. The other calls the same routine (based on print statements in my log file) and then fails with:

Error parsing XML: XML InputStream(2) cvc-elt.1: Cannot find the declaration of element 'persistence'.

And I have no idea why one works and the other doesn't. Can anyone help me figure that out?

More important, is there something I can put in the persistence.xml file that will make Eclipse think the format is correct? I can copy the validation files from oracle and store them somewhere - but they would need to be accessible to the persistence file - how would I specify that and where should I put them?

I've been beating my head against a wall on this for some time now - I'd appreciate any help anyone can give me...

thanks,

nbc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.