Reputation: 51
Hi i tried to execute this query it running properly in mysql database . by using hibernate its returning null value can you explain me thanks in advance by karthik
string = "SELECT sum(feed1Consumed),sum(feed2Consumed)"
+ "FROM com.ebiodata.upstream.pojo.UpstreamMammalianFermentationTempUpdate"
+ " where upstreamHeader.id=\'" + serializableId + "\'";
Upvotes: 0
Views: 4945
Reputation: 5303
sum() returns null if the summed value is null for all summed rows or if there are no rows found.
In hibernate.cfg.xml
you can use <property name="show_sql">true</property>
to see the SQL statement which is generated by hibernate.
I don't understand why you compare the id as a string. serializableId
probably is a number. You can do a numeric comparison with
" where upstreamHeader.id=" + serializableId;
Upvotes: 1