[EJB/JBoss] - CMR fileds available after raw SQL delete of related records
by jivkoto
Hi I have problem with Conteiner Managed Relation.
Environment: JBoss 4.0.4.GA, JDK 1.5.0_07 on WindowsXP + SP2, SQL SERVER 2000
I have two EJBs A and B with container managed bidirectional relation (one ? many). I am using direct SQL to delete the records for B related with one of A?s instances.
Later when I call a.getBs(), returned collection is not empty, even if the entities are removed.
If I get B?s home interface and make b.findByA(PK) the returned collection is empty.
It seems that the relation is not updated.
Here is a simple snippet.
//This is in Entity A.
|
| public boolean hasInstances()
| {
|
| Collection coll = null;
| try
| {
| BHomeLocal processHome = ? //perform lookup here
| coll = processHome.findByAid(getId());
| }
| catch (NamingException e)
| {
| e.printStackTrace();
| }
| catch (FinderException e)
| {
| e.printStackTrace();
| }
| //Note coll is empty. No B entities found
|
| Collection bCollection = getBs(); //CMR of A
| return (!bCollection.isEmpty());
| //Note that it returns false, and bCollection contains the ids of the //removed B instancess
| }
If anyone can help to tell is it bug or I am doing wrong that I am using direct SQL to delete records. 10x
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977257#3977257
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977257
19 years, 7 months
[JBoss Seam] - Re: How can I create seam context etc in httpservlet
by sebasfiorent
No, SeamServletFilter is intended to create an process Ajax calls.
I've implemented a Filter which does some things, and uses Seam components.
Inside my Filter class I have the following method which gets called in every request.
protected void inicarSeam(ServletRequest request, ServletResponse response) {
HttpSession session = ((HttpServletRequest) request).getSession(true);
Lifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
Lifecycle.setServletRequest(request);
Lifecycle.beginRequest(servletContext, session, request);
Manager.instance().restoreConversation(request.getParameterMap());
Lifecycle.resumeConversation(session);
Manager.instance().handleConversationPropagation(
request.getParameterMap());
}
And in my doFilter() method:
String userName = httpRequest.getUserPrincipal().getName();
inicarSeam(request, response);
Usuario usuario = (Usuario) Component.getInstance(Usuario.class, false);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977255#3977255
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977255
19 years, 7 months
[JBoss Seam] - Re: How can I create seam context etc in httpservlet
by sebasfiorent
No, SeamServletFilter is intended to create an process Ajax calls.
I've implemented a Filter which does some things, and uses Seam components.
Inside my Filter class I have the following method which gets called in every request.
protected void inicarSeam(ServletRequest request, ServletResponse response) {
HttpSession session = ((HttpServletRequest) request).getSession(true);
Lifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
Lifecycle.setServletRequest(request);
Lifecycle.beginRequest(servletContext, session, request);
Manager.instance().restoreConversation(request.getParameterMap());
Lifecycle.resumeConversation(session);
Manager.instance().handleConversationPropagation(
request.getParameterMap());
}
And in my doFilter() method:
String userName = httpRequest.getUserPrincipal().getName();
inicarSeam(request, response);
// Si llego acá es porque el contenedor nos autenticó
Usuario usuario = (Usuario) Component.getInstance(Usuario.class, false);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977254#3977254
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977254
19 years, 7 months