Lakshmi Natarajan

Greenhorn
+ Follow
since Jun 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Lakshmi Natarajan

Ankit,

visited the site but the information would not be useful for me. The <meta> tag default value is used while generating the POJO class from hbm file(the POJO class generated with the default value set in setter method of the property) and does not set default value for the property for exisiting POJO class

Our application needs to update a default value to a property suppose it was supplied or set. This can be done by defining default in DDL, but we cannot change the databse. We need to set this value through xml as this default value might change in future. Is there any provision in hbm file to set default value for a property.
Thanks Cameron and Rahul. Both the solutions have worked out for the query.
Hi
I am using hibernate3 in my application. When executing the below code
Product exampleProduct=new Product();
exampleProduct.setPrice(22);
Example example=Example.create(exampleProduct);
Criteria criteria=session.createCriteria(Product.class);
criteria.add( example );
List results = criteria.list();

it works fine. Lists all the objects with the price is 22. when modified the code as below

Product exampleProduct=new Product();
exampleProduct.setName("Product 2");

Example example=Example.create(exampleProduct);
Criteria criteria=session.createCriteria(Product.class);
criteria.add( example );
List results = criteria.list();

returns the empty list but the database has few products with the name "Product 2". When I checked the query generated,
Hibernate: select this_.id as id0_0_, this_.name1 as name2_0_0_, this_.description as descript3_0_0_, this_.price as price0_0_, this_.supplierId as supplierId0_0_ from product2 this_ where (this_.name1=? and this_.price=?)

the where condition sets parameter value for price. I have executed this code with different properties of the product object but the generated query always adds price parameter value set and returns empty list.

Is it a bug and is it overcomed in the latest version of hibernate or do I need to set any property for proper working of this code..
My application requires to refresh the hibernate cache periodically (for every hour should sync the contents in cache with database). The duration of the refresh might be modified by the application user in the future (requirement) hence would like to specify it in config file instead of using refresh method in the code. Please let me know whether any tag or attribute available in config files for this set up or provide me better solution for this case.