Hibernate: Data Object with a dynamic table name by Annotations

后端 未结 6 863
抹茶落季
抹茶落季 2020-12-09 13:06

I have a Data Class for Hibernate associated to a table; imagine the Entity Person like this:

 @Entity
 @org.hibernate.annotations.Proxy(lazy=false)         


        
6条回答
  •  醉话见心
    2020-12-09 13:08

    Modified at runtime(I think it's the best way):

    Session session = super.getSession();
        SQLQuery query = session.createSQLQuery("raw sql");
        query.setParameter(":abc", "value");
        query.addEntity(Some.class);
        return query.list();
    

提交回复
热议问题