How can we call a stored procedure with Hibernate and JPA?

后端 未结 7 1389
时光取名叫无心
时光取名叫无心 2020-12-15 06:34

How can we call a stored procedure using Hibernate or JPA?

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-15 07:29

    one approach can be with getNamedQuery().

    Query query = session.getNamedQuery("callStockStoreProcedure")
        .setParameter("stockCode", "7277");
    List result = query.list();
    for(int i=0; i

    you have to map or use annotations

    there are others: source

提交回复
热议问题