-->
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: Difficulty Overriding Annotations w/ xml
PostPosted: Wed Jun 21, 2006 8:28 pm 
Newbie

Joined: Wed Jun 21, 2006 8:13 pm
Posts: 2
I'm trying to override an entity configured w/ annotations with an external xml file. I'm manually creating the Factory in HibernateUtil, but I've also tried adding it to the hibernate.cfg.xml, and get the following error:

Code:
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.hibernate.cfg.Configuration.xmlHelper from class org.hibernate.cfg.AnnotationConfiguration
   at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:556)
   at hibernate.HibernateUtil.makeOverriddenFactory(HibernateUtil.java:112)
   at golf.speed.NewHierarchy.doWork(NewHierarchy.java:21)
   at golf.speed.NewHierarchy.main(NewHierarchy.java:17)
   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:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)




Here's is the code to create the factory

Code:
AnnotationConfiguration conf = new AnnotationConfiguration();
File confFile = new File(GlobalProperties.getProperty("hibernate_config"));
            conf.configure(confFile);
conf.addAnnotatedClass(MapData.class);
conf.addFile(new File("c:/dave/weatherbonk/annotOverride.xml"));



and the annotOverride.xml is
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 orm_1_0.xsd"
        version="1.0">

    <package>weathermaps.weather.points</package>
    <entity class="MapData">
        <inheritance strategy="TABLE_PER_CLASS"/>
    </entity>
</entity-mappings>



I'm using annotations 3.2CR1 and hibernate 3.1.3 with mysql 5.0
I'm trying to follow
http://www.hibernate.org/hib_docs/annot ... overriding

but it doesn't show how to integrate this file to the configuration.

Is there another method to use to add this configuration override to the AnnotationConfiguration object.
Any help is greatly appreciated


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.