Win a copy of Spring Boot in Practice this week in the Spring forum!

Priyanka Sumanam

Greenhorn
+ Follow
since Aug 17, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Priyanka Sumanam

Saw this some where.......may be this could help.....am not sure


Before (Spring 2.0 and earlier):



After (Spring 2.5):

11 years ago
Ok...thanks for explaining...possible that I got it wrong somewhere....will let you know if I have any other ideas.
11 years ago
If you set all you properties under <properties> tag in pom you will not get this problem as per the link you attached.But i didn't suggest you this a
its not feasable to lis all the properties in pom when you have many.
But both are same.It is way to let maven know about the properties you want to use acorss the application.

coming back to you question, i gues you exception is raised exactly at this lin



I am not sure what the DatabaseConfiguration constructor is doing internally .But it is trying to acces the Datasource bean which is wired in you application context as



now it is trying to get the driverClassName name.But here ${db.driver} is not replaced by the actual value at build time as it did not find the property and so it is trying to search for a driverclass with name ${db.driver} which is obviously not found.

And even if it happens at runtime , maven should know where the db.properties file is to replace the valuse. if you configure your properties under properties tag in pom it will create a build.properties for all the ones there.But if you are using you own , you should tell it so.

Any way did you try configuring it as i suggersted ealier?

11 years ago
Irrespective of, if its build time or runtime thing, there should be a way to tell maven to add those resources to be available for the project, to go and search for the ${name} values to be replaced by its values.

And ofcourse it is a buildtime thng.When you you bild you project maven replaces all ${name} properties wiht its values if they are found in the properties files that it is aware of.
If we dont configure them in pom, they go unnoticed.
11 years ago
have you configured your db.properties file in pom.xml as below




for your referencce
http://maven.apache.org/pom.html#Properties

Please ignore if you have already don it.
11 years ago
Hi Joy,
Here is the full code. Result list is JDBC ResultSet



Thanks
I have the below code which takes more than a minute to iterate through 5000 records...which is not acceptable performance

while( rs.next() )
{
Object[] resultFields=new Object[colCount];

for(int i=1;i<=colCount;i++)
resultFields[i-1]=rs.getObject(i);
resultList.add(resultFields);

}

Could any one suggest something.
Thanks for the reply Rishi.I can ovverride the fetchmode on the properties directly defined on the entitiy I am querying on.But the problem here is because of the settings on a associated entity of the current entity.

I will try to explain with simple terms.

Two entities A and B.

<hibernate-mapping>
<class name="A" table="A" >
<many-to-one name="b" column="BUFI" class="Bi" entity-name="B" lazy="proxy"/>

</class>
</hibernate-mapping>

Definition of entity B that is associated to class A is below
<hibernate-mapping>
<class name="B" table="B" lazy="false" entity-name="B">


</class>
</hibernate-mapping>

associated property B is set to lazy="proxy" which is not taking effect as B is set to lazy="false" at the entity level.
Now when i am trying to load entity A, i can override fetchmode of it's own associtions which is any way set to lazy="proxy".I don't have any problem here.
The issue is cant override fetch mode of entity B,i.e set at its entity level.

Well, due to certain reasons which are part of business logic, we have to set lazy="false" for B at entity level.




Hi Rishi,

I am not getting any exception.My concern is that, it is talking awful lot of time to load a list of AOISELECTSETDETAIL objects(am using session.load()) as it is fetching the associated AOI object as well which in turn have a lot of properties set to lazy="false".I have set lazy="proxy" on definition of property AOI in AOISELECTSETDETAIL hbm file.But still that is not taking effect as the whole AOI entity is set to lazy="false" in its hbm as i highlighted below.
I done want to change the lazy setting on the associated hbm.

So the question is is there any way to avoid loading the associated object irrespective of what is set at the entity level in its hbm.

I hope this is clear enough atleast this time.

Hi allm
I have a hbm as below

<hibernate-mapping>
<class name="au.gov.biosirt.bo.AoiSelectSetDetail" table="AOISELECTSETDETAIL" >
<id name="id" column="AOISELECTSETDETAILUFI" type="java.lang.String" unsaved-value="null" />
<many-to-one name="aoiSelectSet" column="AOISELECTSETUFI" class="au.gov.biosirt.bo.AoiSelectSet" />
<many-to-one name="aoi" column="AOIUFI" class="au.gov.biosirt.bo.Aoi" entity-name="Aoi" lazy="proxy"/>
<property name="aoiTargetPFI" type="java.lang.Long" />
<property name="aoiTargetDatasetId" type="java.lang.String"/>
</class>
</hibernate-mapping>

on calling session.merge() on the above class, lazy="poxy" on AOI is not working because the the lazy="false" setting on the mapping of the corresponding class as below

<hibernate-mapping>
<class name="au.gov.biosirt.bo.Aoi" table="aoi" lazy="false" entity-name="Aoi">
<id name="id" column="aoiufi" type="java.lang.String" unsaved-value="null" />
<property name="instanceId"/>
<property name="lastUpdatedDate"/>
<property name="lastUpdatedUserId"/>
|

|...

</class>
</hibernate-mapping>

I don't want to change the lazy fetching on the assosciated class to fix it.Is there any way around to avoid loading full AOI object on accesing AOISELECTSETDETAIL.
I am using JSF with tomcat 7.0.8 .I am getting the below exception in application after the session time out instead of getting a session time out alert, and its throwing a 500 Error on screen.

10/07/2011 1:58:20 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/biosirt] threw exception [Cannot create a session after the response has been committed] with root cause
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2691)
at org.apache.catalina.connector.Request.getSession(Request.java:2228)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:899)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.getSession(ServletExternalContextImpl.java:197)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.nextViewSequence(JspStateManagerImpl.java:544)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.getSerializedViewFromServletSession(JspStateManagerImpl.java:536)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreTreeStructure(JspStateManagerImpl.java:255)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:283)
at org.ajax4jsf.framework.ajax.AjaxStateManager.restoreView(AjaxStateManager.java:83)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:255)
at org.ajax4jsf.framework.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.restoreView(AjaxViewHandler.java:150)
at org.apache.shale.view.faces.ViewViewHandler.restoreView(ViewViewHandler.java:164)
at org.ajax4jsf.framework.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
at org.ajax4jsf.framework.ajax.AjaxViewHandler.restoreView(AjaxViewHandler.java:150)
at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:141)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:268)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

could any one help me in sorting this out
11 years ago
JSF
Well I was preparing for SCWCD 5, but now as SCWCD 6 is out, I am planning to prepare for SCWCD 6.But I am not able to find right material for that.It would be great if any one could help in this regard.
Joe,

Thanks for the explanation.I totally agree with what you said.It would be waste of effort to do so.

Cheers
Priya
11 years ago
May be i can extend the Hibernates query class and overload the list() method to return List<Objec[]> and use it for special cases like this in the application.

But, is it worth doing it just for the sake of this warning?
are there any potential unforeseen problems if I leave it so?

Thanks in advance
Priya
11 years ago