[EJB 3.0] - How to implement a last modified or last user field ?
by johanmicoud
Hello,
I'm trying to find a way to solve this tricky problem.
I want to ensure that all modifications made on my EJB 3 entities are traced in a specific column (or field).
I use a security context and I'd want to store the getSubject() and the current date in two fields.
The idea is to get rid of the sessionContext (which contains the sessionContext.getCallerPrincipal().getName()) before any (real) update or persist operation.
I have tried to implement PreUpdate and PostUpdate with a method containing lastModified=new Date(). But how to get the CallerPrincipal ?
It is ok when I use a ThreadLocal and propagate my context between the session bean and the entity beans. But I use intensively Cascade merge/update operations. The @preUpdate method is called whenever the field is really stored or not.
Is there a way to implement that use case as a simple SQL Trigger ?
Thank a lot
Yohan
ps : I have tested the tips in the Auditing chapter in Java Persistence book without success
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157674#4157674
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157674
17 years, 10 months
[Installation, Configuration & DEPLOYMENT] - Remote JMS Accessing not working
by ranadheer.machineni
Hi,
i am running a application in Jboss, which connects to JMS of another Remote JBoss. the problem is i am able to connect and receive Topics when i supply remote url to context like below
| Properties pro = new Properties();
| pro.put(Context.PROVIDER_URL,"jnp://remotehost:1099");
| jndiContext = new InitialContext(pro);
|
but when i remove the above and supply to jms-ds.xml like below its not working. it says the name of the Topic not found
|
| <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
| name="jboss.mq:service=JMSProviderLoader,name=JMSProvider">
| <attribute name="ProviderName">DefaultJMSProvider</attribute>
| <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
| <!-- The combined connection factory -->
| <attribute name="FactoryRef">XAConnectionFactory</attribute>
| <!-- The queue connection factory -->
| <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
| <!-- The topic factory -->
| <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
| <!-- Uncomment to use HAJNDI to access JMS-->
| <attribute name="Properties">
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=remotehost:1099
| </attribute>
|
| </mbean>
|
|
i tried with port number 1100 also, but help less. i need to use the second way any ways. any help is highly appreciated
Thanks
R
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157659#4157659
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157659
17 years, 10 months