Hello,
We are working with diferents schemas for real and test and for this we use an interceptror:
public class HibernateInterceptor extends EmptyInterceptor {
@Override public String onPrepareStatement(String sql) { String prepedStatement = super.onPrepareStatement(sql); prepedStatement = prepedStatement.replaceAll("_@libako@_", ApplicationBean.getLibAko()); prepedStatement = prepedStatement.replaceAll("_@libakov4@_", ApplicationBean.getLibAkoV4());
.......
An we have a legacy table with and id generated from a register in other table.
This works with the table generator:
@Id @TableGenerator(name="CertificatGen", table="_@libako@_.ids", pkColumnName="NOM_TAULA", pkColumnValue="CERTIFICAT", valueColumnName="ID", allocationSize=1 ) @GeneratedValue(strategy=GenerationType.TABLE, generator = "CertificatGen") private int num; .....
But in this case the interceptor not works and _@libako@_ is not replaced for the correct schema.
We can solve the problem with other solutions (like add an id column to the table). But it will be better if the table generator and the interceptor works together.
Any ideas ?
Thanks,
Josep R. Raurell Ako Electromecanica S.A.L.
|