[JBoss Seam] - Re: @Startup and Seam interceptor
by xinhua
hi,
yes, interceptor works fine with other component without @Startup
At first, i have two annotations
| @Target(TYPE)
| @Documented
| @Retention(RUNTIME)
| @Interceptors(KleberInterceptor.class)
| public @interface Kleber
| {
|
| }
|
interceptor is supposed to check filed with @Jndi annotation and take the string from @jndi for jndi lookup
| public class KleberInterceptor {
|
| @PostConstruct
| public Object jndiLookup(InvocationContext invocation )throws Exception{
| Object target = invocation.getTarget();
| Field[] fields = target.getClass().getDeclaredFields();
|
| try{
| InitialContext ctx = new InitialContext();
| for(Field field: fields){
| Jndi jndi = field.getAnnotation(Jndi.class);
| if(jndi!=null){
| Object obj = ctx.lookup(jndi.value());
| field.setAccessible(true);
| field.set(target, obj);
| }
| }
|
| }catch(Exception ex){
| ex.printStackTrace();
| }
|
| return invocation.proceed();
| }
|
| @AroundInvoke
| otherMethods............
|
|
| }
|
I can not use @Kleber on a component which already has a @Startup, what i can do now ,is to write jndi lookup codes directly in @Startup component, and it works.....
is there any better way to inject jndi resouce in @Startup Seam component?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108946#4108946
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108946
18 years, 5 months
[JBoss Seam] - Re: Problems Using Oracle datasource to run a Seam Test usin
by kfletcher2005
Not necessarily all the services the embedded container has to offer, just the persistence part. It gives me more confidence in the unit test when I test against oracle. When a dba applys changes adds/removes contraints/columns to our oracle schema, I really don't want to have to sync up each change and apply to hypersonic because its a maintenance headache trying to keep the DDL/DML synchronized - (at least I don't know of a way to auto-sync the schema changes between oracle and hypersonic). I know you can use the entities themselves to create/drop the tables in hypersonic, but there are times we have to write native sql and or stored procedures to optimize performance. If we are exclusively using the ORM layer for persistence, I guess we could use hypersonic for testNG and allow the create-drop feature in persistence.xml, but that would give us limited test coverage.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108943#4108943
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108943
18 years, 5 months