Re: Maven + HIbernate3 + Annotations, problems with SchemaExport
"Brian Weaver" <[email protected]>
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Message-ID | <[email protected]> |
Hendrik, I found this out the hard way not long after asking for help. It always seems that I beat my head against the proverbial wall for what seems like an eternity, ask for help, and then find the answer. Adding the mapping in the hibernate configuration does indeed work. I tried the "package" attribute, but it seems that when that mapping is used Hibernate expects a class called 'package-info' to live in the package with annotations that map to all of the annotated class files. The package-info class doesn't appear to be documented anywhere based upon my searching. It's mentioned in the hibernate annotation documentation briefly, but with any real explanation. Since this is likely to be a simple application running in a servlet container and not a full blown J2EE stack I was hoping to find a way to have Hibernate "discover" all the annotated classes without explicit mappings. I'm fine with creating the mappings, I just missed that step initially. Thank you for the help! -- Brian On Mon, May 19, 2008 at 2:49 PM, Hendrik Schreiber <hs-doAduxQln/dWk0Htik3J/[email protected]> wrote: > You'll still need to list your annotated classes in hibernate.cfg.xml and > put that in the classpath: > > <!DOCTYPE hibernate-configuration SYSTEM > "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> > <hibernate-configuration> > <session-factory> > [...] > <mapping class="com.yourcorp.AnnotatedClass"/> > </session-factory> > </hibernate-configuration> > > -hendrik > > tagtraum industries incorporated > http://www.tagtraum.com/ > http://www.beatunes.com/ > > On May 19, 2008, at 13:22 , Brian Weaver wrote: > >> I'm hoping someone on the list might be able to give me a clue on what >> I'm doing wrong with Hibernate. What seems like a very simple problem >> has been driving me insane for the last few days. No amount of >> searching on google, reading the documentation, or scouring the FAQs >> seem to have helped me much. >> >> My problem is fairly straightforward. I've created a few classes that >> have javax.persistence annotations so that my all of my configuration >> information is in a single class. This avoids me having to keep the >> java source files in synchronization with the *.hbm.xml files. Now >> that I have the annotated class files I want to use Hibernate's >> SchemaExport tool to generate my initial SQL tables. The idea is for >> me to do all the work using annotations, then generate my scheme, >> clean it up a bit (indexing, etc), and then create the database. >> >> After fighting with Eclipse and maven I have the schema export tool >> running, but it doesn't seem to process any of my annotated files. >> >> Any ideas? >> >> -- Weave >> >> -- >> >> /* insert witty comment here */ >> >> _______________________________________________ >> Juglist mailing list >> [email protected] >> http://trijug.org/mailman/listinfo/juglist_trijug.org > > -- /* insert witty comment here */