devdoc

Tuesday, November 29, 2005

DQL to get the folder_path from r_object_id

Select s.r_object_id, fr.r_folder_path + s.object_name
From dm_sysobject s,dm_sysobject_r sr,dm_sysobject_r sr3, dm_folder_r fr
Where s.i_is_deleted = 0
AND sr3.r_object_id = s.r_object_id
AND sr3.i_position = -1
AND sr.r_object_id = s.r_object_id
AND fr.r_object_id = sr.i_folder_id
AND fr.i_position = -1
AND s.r_object_id = '[OBJECT_ID]'

Monday, November 28, 2005

SpringFramework kills me softly

This 2 lines have caused me a lot of trouble... Well, at the end it was not so complicated, but it does not help to feel me better... How much time lost for these two lines... snif snif...


WebApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
portlet.getContext());
BasicDataSource ds = (BasicDataSource) ctx.getBean("dataSource");



When you have a web application using Spring, and you want to use some bean from the definition, you ca use several different methods, but this one is probably the most powerful and leverages your Webapp....

But to make it work, you have to add this to the web.xml config file:


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/intranet-servlet.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>