-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to use Hibernite without java beans and recompilation
PostPosted: Tue Feb 01, 2011 4:16 am 
Newbie

Joined: Tue Feb 01, 2011 4:07 am
Posts: 1
I have a rare use cases and I'd like to ask some advice from anyone who has deep inside view of Hibernate architecture.

If I simplify our goal then I can say our goal is to design a system that does not require further development and code compilation to execute simple CRUD operation on objects in RDBMS. Our objects are mostly XMLs and the objects are described via XSD schema. Add or change certain object you just need to change the XSD schema.

I know It sounds weird and you may have many concerns about it but as I said it's a simplification of our goal. I'm going deeper into the details soon.

You may come up with an idea to use xmldb or something like hyperjaxb3 or something else. I was doing the same resource and I even found a scientific article about how to store XML objects in a relational database.

I'm still open for a discussion and for any solution that helps us to achieve the final goal.

Right now I'm investigating a possible solution with Hibernate. Let's assume I have a module with it's own XSD parser that can read in the XSD and add all meta information I need to configure the Hibernate session.

Solution 1: I generate a very rich Hibernate Mapping documents (hbm.xml) and create a new Configuration object by adding these to it.
Solution 2: I skip the indirect hbm document creation and I create a new Configuration object in a different way. I have now idea how it's possible.


If I could solve this problem then I can build a Hibernate Session object and use it but then comes the next problem. As I said I don't want to recompile the code again and I don't have the Entity beans. All I want is get the object from the database and put it into a java object.

I always used Entity Beans and annotations to configure my persistency layer but now I'm looking for some alternative something like the tupilizer. I have never used that before so I don't know it
is the right interface or not.

I'm thinking in two different ways:
One come from my lack of knowledge where the Entity Bean class is required so if they are not there at compile time then they can be created in runtime with something like javassist or ASM.

Second when I rather prefer some closer integration where I get the properties and I fill my object for instance a Map, DOM4J or something else.

The XML was also an example because I may have to serialise this object into a json format or when I receive the XML then I have to parse it and pre process it in some way before I can hand it over to the Hibernate.

So I'm looking for a solution to be able to configure a SessionFactory from my configuration and create new Sessions and I'm looking for the way to skip the entire Entity Bean concept and read and write into my custom java object.

If you have any idea, advice or suggestion I welcome every help and I'm looking for a discussion where we can even talk about some other solutions too.

Thank you any help in advice.


Top
 Profile  
 
 Post subject: Re: How to use Hibernite without java beans and recompilation
PostPosted: Tue Feb 22, 2011 9:08 pm 
Beginner
Beginner

Joined: Mon Jun 28, 2010 1:02 pm
Posts: 21
I cannot solve your problem unfortunately, but I have something similar. I don't have XSDs about the data schema. I only have a series of records, but I don't know the number of the fields/columns, type of the fields/columns.
I want to read that into a JavaBean, and the question is how I can persist and handle that dynamically run-time created JavaBean class with Hibernate. Since I don't know the above mentioned things, I cannot configure the Hibernate mapping compile time.
See more:
https://forum.hibernate.org/viewtopic.php?f=1&t=1009680


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.