-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: interceptor not working for @GeneratedValue @TableGenerator
PostPosted: Thu Jun 11, 2009 4:07 am 
Newbie

Joined: Thu Jun 11, 2009 3:16 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.