• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Hibernate + Dynamic Groovy Class (Is this even possible)

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,

Having a mental exercise right now.

I've got a file on my computer called User.groovy



Then I wrote a JSP that does this:


In a nutshell, the JSP is compiling the groovy file and then invoking the "test" method that tries to put test data through hibernate. The file compiles, but it bombs at the test call with the error Unknown entity: com.test.User

I get the error, do you get what I'm trying to do? Basically I'm trying to dynamically load a class into hibernate and have it create the tables and the content. Is this even possible?

Not sure if it matters but here's my persistence xml


and here's how I create the entity manager factory


That part should work, it's a copy from an existing hibernate app that I've been working with for awhile. And if I comment out the code inside User.test() the whole thing compiles with no errors. I understand the error, I'm just not sure if what I'm trying to do is even possible. Any ideas?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic