[JBoss Portal] - Re: problem with IPC
by sbiwal
Hi Ruchika,
There are three things important deployment descriptors for a portlet in JBoss -
1) portlet.xml - this file relates a portlet name to a portlet class
2) portlet-instances.xml - this file relates the portlet name defined above to a portlet instance. Now the same portlet can have more than one instances.
3) -object.xml - usually replace the part with the name of your portlet. This file defines a window (which is the actual view that you see in your portal) to a portlet instance. Once again the same portlet instance can be rendered using multiple windows eg you have your portlet instance in 2 or pages. The event listeners are bound to these windows. So when you declare this window (in your *-object.xml file), you should list the listener with it. Only this window of the portlet will listen to events (with the listener id specified by you) and not the other windows for the same portlet.
I am pasting an example of the *-object.xml file here -
| <?xml version="1.0" encoding="UTF-8"?>
| <deployments>
| <deployment>
| <parent-ref>myPortal</parent-ref>
| <if-exists>overwrite</if-exists>
| <page>
| <page-name>MyPage</page-name>
| <window>
| <window-name>
| MyPortletWindow1
| </window-name>
| <instance-ref>
| MyPortletInstance
| </instance-ref>
| <listener>ipc_listener</listener>
| <region>center</region>
| <height>1</height>
| </window>
| <window>
| <window-name>
| MyPortletWindow2
| </window-name>
| <instance-ref>
| MyPortletInstance
| </instance-ref>
| <region>left</region>
| <height>1</height>
| </window>
| </page>
| </deployment>
| </deployments>
In the above file, note the following things -
1) You should have a portal with the name MyPortal.
2) Now a new page will be created in this portal - MyPage
3) The first window in this page - MyPortletWindow1 uses the instance MyPortletInstance and throws events with listener id ipc_listener. Whatever is your listener class associated with this listener id, will honor such events.
4) The second window in this page - MyPortletWindow2 uses the same portlet instance MyPortletInstance but does not throw events with the listener id ipc_listener
5) Now just specify your listener class in the jboss-service.xml descriptor (as specified in the reference guide) and you'll be done.
Please do not hesitate to ask me any more doubts. I struggled with this for a long time myself and would like it if my digging could help anyone.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152555#4152555
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152555
17 years, 11 months
[EJB 3.0] - Re: OneToMany Unidirectional EntityManager remove() problem
by rkiran81
Hi JaiKiran,
Thanks for your reply.
With Child PROFILE_ID (parent id) column Allowing Not Null values, below is the code and stack trace.
|
| @OneToMany(cascade = {CascadeType.ALL})
| @JoinColumn(name="PROFILE_ID")
| @org.hibernate.annotations.Cascade(value=org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
| public Collection getQueryProfileBean()
| {
| return queryProfileBean;
| }
| 11:44:13,310 WARN [JDBCExceptionReporter] SQL Error: 515, SQLState: 23000
| 11:44:13,310 ERROR [JDBCExceptionReporter] Cannot insert the value NULL into column 'PROFILE_ID', table 'QAUsers.dbo.LK_
| PROFILE_QUERY'; column does not allow nulls. UPDATE fails.
| 11:44:13,325 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
| org.hibernate.exception.ConstraintViolationException: could not delete collection rows: [com.bis.dbservices.domainprofil
| edao.DomainProfileBean.queryProfileBean#7106370]
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
| at org.hibernate.persister.collection.AbstractCollectionPersister.deleteRows(AbstractCollectionPersister.java:11
| 40)
| at org.hibernate.action.CollectionUpdateAction.execute(CollectionUpdateAction.java:54)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:142)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:29
| 7)With Child PROFILE_ID (parent id) column Allowing Null values, below is the code.
|
| @OneToMany(cascade = {CascadeType.ALL})
| @JoinColumn(name="PROFILE_ID")
| public Collection getQueryProfileBean()
| {
| return queryProfileBean;
| }
|
| Works fine.
org.hibernate.annotations.CascadeType.DELETE_ORPHAN is not helping in any way. Just make the parent id in child table to allow null and CascadeType.ALL will do the job.
It actually inserts null and then deletes the column. This is what i found.
Even am trying to find any other way for this ie.. with parent id column to allow nulls, if you get any idea on this please update the same.
Thank you very much for your support.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152550#4152550
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152550
17 years, 11 months
[JBoss Portal] - Copying a window from page to page - not rendered
by nystaa
Hello,
I am trying to copy a window from a page in the portal to the current navigation page and the window is not rendered after it addition.
| PortalObject object = JBPServiceLocator.getPortalObjectContainer().getObject(sourceWindowPortalObject);
| System.out.println("Trying to add " + object.getName());
| Window window = (Window) object;
| Page page = (Page) pagePortalObject;
|
| String regionName = "center-top-wide";
| String string = window.getName() + "xyz";
|
| PortalObject copy = window.copy(page, string, false);
| Window child = (Window) page.getChild(string);
| child.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, regionName);
|
| for(Object obj : page.getChildren()){
| if(obj instanceof Window){
| Window po = (Window) obj;
| System.out.println("po " + po.getName());
| }
| }
|
| I am sure that the layout of the page has the region that is assigned to the new window.
|
| After the copy the new window appears as a child of the page.
|
| Is there anything else that I need to do to get the window to render?
|
| Thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152549#4152549
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152549
17 years, 11 months