I have query in SQL like
select part_no, base_price, fn_get_ecom_item_new_price(Company_id, Part_No, Unit, Price, 'N') newPrice from ecom_prodmast
if there is an option to run the same query in hibernate? there is any other way to execute a select query with function in hibernate?
You can use session.get() method from Hibernate and the generated Java classes, then will look something like that:
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.openSession();
Transaction t=session.beginTransaction();
Economy e= (Economy) session.get(Economy.class, part_no ....);
t.commit();
session.close();
return e.getData();
The main Economy class should be configured to hold your data like part_no, base_price, fn_get_ecom_item_new_price, etc. of your ecom_prodmast table. That means first configure Hibernate and generate the classes, then use them. You can find examples on the internet on how to. If you are using Eclipse is even simpler, because it exists a plug-in that does that for you. If you want to access the procedure, that should also exist in the generated files and you call it as a simple function.