• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic