Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Read that. Also read the first 6 chapters of
Java Persistence with Hibernate. I've successfully reverse-engineered the legacy DB using the Hibernate tools (though Ant) and created a JPA project in Eclipse to allow me to work on the code. My problem is that Eclipse won't let me create a Hibernate project - only a JPA project (which expects full use of persistence.xml and orm.xml) and I want to use Annotations. However, using Annotations with the empty skeletons of xml files causes JPA errors at the Entity annotations that the entity cannot be resolved. Adding the entities to persistence.xml through <class> tags removes the errors at the Entity tags and now complains about every column name as
Quote:
cannot be resolved
.
I can generate a Hibernate Console Configuration (and have), but that doesn't remove the errors. Is there a way to remove the errors besides listing all the classes and all their attributes in the xml files?
All help is greatly appreciated.
Craig
Hibernate version:
Hibernate 3.2
Mapping documents:
persistence.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="CNODB0.5">
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class"
value="com.sybase.jdbc2.jdbc.SybDriver"/>
<property name="hibernate.connection.password" value="*****"/>
<property name="hibernate.connection.url"
value="jdbc:sybase:Tds:137.51.134.148:3000/CNODB"/>
<property name="hibernate.connection.username" value="*****"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.SybaseDialect"/>
<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
<property name="hibernate.show_sql" value="true"/>
<property name="format_sql" value="true"/>
</properties>
<class>mil.cnodb.CnoAka</class>
<class>mil.cnodb.CnoColumn</class>
<class>mil.cnodb.CnoDetail</class>
<class>mil.cnodb.CnoHistory</class>
<class>mil.cnodb.CnoImageRef</class>
<class>mil.cnodb.CnoImageRefAssoc</class>
<class>mil.cnodb.CnoNetLink</class>
<class>mil.cnodb.CnoNetLinkAssoc</class>
<class>mil.cnodb.CnoNetLinkAssocSeq</class>
<class>mil.cnodb.CnoNode</class>
<class>mil.cnodb.CnoNodeAssoc</class>
<class>mil.cnodb.CnoObject</class>
<class>mil.cnodb.CnoParam</class>
<class>mil.cnodb.CnoRemark</class>
<class>mil.cnodb.CnoRemarkAssoc</class>
<class>mil.cnodb.CnoSource</class>
<class>mil.cnodb.CnoSourceAssoc</class>
<class>mil.cnodb.CnoSourcePedigree</class>
<class>mil.cnodb.CnoUser</class>
<class>mil.cnodb.ColumnParam</class>
<class>mil.cnodb.Constellation</class>
<class>mil.cnodb.Detail</class>
<class>mil.cnodb.DetailObject</class>
<class>mil.cnodb.Eqp</class>
<class>mil.cnodb.EqpIdx</class>
<class>mil.cnodb.Event</class>
<class>mil.cnodb.Fac</class>
<class>mil.cnodb.GenColumn</class>
<class>mil.cnodb.GenLink</class>
<class>mil.cnodb.GenNetwork</class>
<class>mil.cnodb.GenNode</class>
<class>mil.cnodb.Groups</class>
<class>mil.cnodb.GroupsDetail</class>
<class>mil.cnodb.GroupsObject</class>
<class>mil.cnodb.GroupsUser</class>
<class>mil.cnodb.Hfac</class>
<class>mil.cnodb.Incident</class>
<class>mil.cnodb.Ind</class>
<class>mil.cnodb.IpToCountry</class>
<class>mil.cnodb.LegalValue</class>
<class>mil.cnodb.LegalValueItem</class>
<class>mil.cnodb.Mat</class>
<class>mil.cnodb.NetLink</class>
<class>mil.cnodb.Object</class>
<class>mil.cnodb.ObjectColumn</class>
<class>mil.cnodb.Occ</class>
<class>mil.cnodb.Ofac</class>
<class>mil.cnodb.Org</class>
<class>mil.cnodb.Param</class>
<class>mil.cnodb.Permission</class>
<class>mil.cnodb.Person</class>
<class>mil.cnodb.Pfac</class>
<class>mil.cnodb.Pspec</class>
<class>mil.cnodb.SourceIp</class>
<class>mil.cnodb.SpaceObject</class>
<class>mil.cnodb.TargetIp</class>
<class>mil.cnodb.Unit</class>
<class>mil.cnodb.UserPermission</class>
</persistence-unit>
</persistence>
orm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<persistence-unit-metadata>
<persistence-unit-defaults>
<catalog>CNODB</catalog>
<access>PROPERTY</access>
</persistence-unit-defaults>
</persistence-unit-metadata>
<!--
<package>mil.cnodb</package>
<entity class="mil.cnodb.CnoAka" table="CNO_AKA"/>
<attribute name="CnoAkaType" column="CNO_AKA_TYPE"/>
</entity>
-->
</entity-mappings>
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
Sybase Adaptive Server Enterprise v 12.5.3.12331 ESD#1
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A