2

I have a very large XML file from a legacy software. Its size is something about 9 GB.

I need to get parts of this XML in a lazy way, just like Hibernate does with databases. I already have POJOs in hierarchical structure to represent the records inside the XML and want to retrieve data from XML from POJO's 'get' methods since I have the Root element. Of course I can create a Manager class or sort of, but I want the same as the Hibernate does with lazy load.

Is there any pattern or library that could be used to change the behavior of a class method, exactly as Lazy Load in Hibernate?

1
  • You can use proxy pattern to achieve this, return a proxy instance and call actual method when really required Commented Jun 20, 2014 at 17:31

1 Answer 1

2

I think your motivation is that huge amount of data. I don't know of any such library and I imagine this as a difficult task, as XML is very hard to point to the needed fragments.

The best I can imagine is event based processing (e.g. SAX) and transform it into an appropriate database scheme. The rest is ordinary JPA (e.g. hibernate) mapping.

Sign up to request clarification or add additional context in comments.

2 Comments

The time to insert all data into database tables should take too much time and storage (there is 1 XML file per day). But I agree, it's an option that I'm considering.
You could omit the transformation step and work directly event based with the XML file without your POJOs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.