Archive for September, 2004

Hibernate - passing a complete object to HQL or find()

I'm currently experimenting with Hibernate (hope I'd get back to OFBiz soon; or that OFBiz uses Hibernate sooner).

Is there a way that I can retrieve (find/load) records from the database using my an object in the following manner:
<code>
   …
   myObject.setFoo(f);
   myObject.setBar(b);
//foo and bar does not relate to the Object's primary keys
//Other properties have null or unset values
  …
List list =   session.find(myObject);
// looks up an object in the database that matches foo (f) and bar(b)
</code>

Is there a similar thing in Hibernate that would allow to load / find an object from the database by passing a temp object filled with the required criteria into a Hibernate function?

Appreciate the help.

UPDATE

Found it - Thanks for the folks at Hibernate Beginner's Forum and anthony from Hibernate team:
http://forum.hibernate.org/viewtopic.php?t=930450&highlight=passing+object+query

The folks at Hibernate have done a great job. It is already there. I'll try it tomorrow.

It's called “Example Queries” (Query By Example - QBE) Pardon my ignorance - it seems that it's already widespread.
http://www.hibernate.org/hib_docs/neference/en/html/querycriteria.html#querycriteria-examples

BackToBasics

It seems that I'll be entering the debate once again.

To Struts or not to Struts?

I'm with. But I'm tired.

I'll try to base my next discussion on this.

 

I'm Back

Lack of motivation for posting? Perhaps.

I've been also busy with some of my research - basically about my own career.

I found myself attending some management studies by Inistitute of Management Development (based on a nomination by the HR). This doesn't mean that I'll be managing anything (except maybe time and myself) in the near future, but it's a nice eye opening refreshment.

I particularly liked the Strategic Management lecturer - Dr. Mohammed Elmasry (the only link I know of).

I hope I'll keep on posting regularly.

Quote of the day

“Knowledge is in the Journey, not in the Final Destination” - Anonymous.

Ofbiz with MaxDB

Finally! I was able to get Ofbiz running with MaxDB.

First impression about MaxDB by MySQL (formerly SAP DB) that it's quite nice. Problems are easier to locate and solve than MySQL (so far). The Database Manager GUI rocks (though I wonder if Database Administrator from MySQL can connect to MaxDB - but perhaps another day for that issue). Still exploring SQL Studio (the Catalogue Manager “Continue” link is awful - I'll try to find some setup to list all the available tables in the database instead of paging those tables with the continue link).

Its support for triggers and stored procedures will sure prove helpful.

I hope I don't run into unsolvable limitations/troubles with MaxDB until I get my feet on solid grounds with Ofbiz.

I plugged Ofbiz to MaxDB after the necessary user creation, RESOURCE user privlege, MaxDB _UNICODE parameter, and rotating log files (after database hung for couple of times).

I loaded the data into the database via the provided functionality in Webtools (run script to load data).

I will soon work on configuring an e-commerce web site (wish me luck).

Eager to hear any experiences with Ofbiz.