« FIRST POST! | Main | HTTPUnit is NOT! »

Novel use of Hibernate?

Listen to this articleListen to this article

I've been working on and off on a project that uses Hibernate persitent classes in Rhino Javascripts.

For various reasons, the database tables (and therefore the persistent classes) aren't known until runtime at which point the meta-data is read from a database.

I used the ASM byte-code library to dynamically generate classes at runtime, map them using Hibernate and expose them with some "fancy" wrappers in Rhino. So anytime they update the database schema, all they need to do is either restart the server or send it a "re-load signal".

All in all a very simple solution that was very easy to get up and running.

Interestingly, the fact that hibernate doesn't require code generation was my saving grace. I'm not suggesting thate code generation is bad but in this particular case it ouldn't have worked as well, IMHO.

I'm now working on doing some file-import using the same "framework". Basically a legacy system spits out EDI-ish data with record types, etc. that needs to be imported. The database meta-data contains a mapping between record types and layout to tables and columns espectively.Again, this will no doubt involve some dynamic class generation to perform the import? But maybe not. I'll start with some tests and see what happens ;-) Gotta love TDD.

Comments

Sounds cool and interesting ;)

Could you be motivated into to post about this stuff on our forum ? (or maybe even show some of the code on a wiki page ?)

More than happy to do something. I'll post some stuff to the wiki in the next couple of days if you like.

"Hey, would you mind posting something more about the ULTRA COOL STUFF you just mentioned?"
"Yeah, right. I'll do"

FOR ALL THE SAINTS, WHERE?????? POST A LINK!!!!

Inquiring minds need to know!!!

Hehehe ok ok....hold ya horses...I'm getting there. I can't just ship it in its current state for obvious reasons ;-)

Ye gods, man where is the link! its been two months ;)

Post a comment