• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate + Dynamic Groovy Class (Is this even possible)  RSS feed

Caden Whitaker
Posts: 24
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!