Java 在@Formula annotation中使用表别名之前,有没有办法知道它?

Java 在@Formula annotation中使用表别名之前,有没有办法知道它?,java,hibernate,alias,Java,Hibernate,Alias,我需要知道将为customer表设置哪个别名Hibernate。我怎样才能做到这一点?我认为唯一的方法是使用subselect @Formula(customer_table_alias + ".count + 1") private int count; 其中,current\u id是实体的id列 @Formula("(select count+1 as new_count from customer_table ct where ct.id=current_id)") private i

我需要知道将为customer表设置哪个别名Hibernate。我怎样才能做到这一点?

我认为唯一的方法是使用subselect

@Formula(customer_table_alias + ".count + 1")
private int count;
其中,
current\u id
是实体的id列

@Formula("(select count+1 as new_count from customer_table ct where ct.id=current_id)")
private int count;