prveen dhannapuneni

Greenhorn
+ Follow
since Oct 13, 2007
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 prveen dhannapuneni

Hello ,

I am integrating Spring DAO's & Transaction management into my existing application. I am using @Transaction annotation with AOP to declare methods in transaction context. But i lately realized that Spring AOP Transaction doesn't support for Self-invocation ( i.e method with in the target object can't call other method in transaction context). Is there any idea to over come this problem?

Any information would be greatly appreciated.

Thanks
Pavan.
9 years ago
Please can you help me to understand all the difference between jdk dynamic proxy vs cglib dynamic proxy.? ( I know only one difference. jdk dynamic proxy uses interface implemenations and cglic dynamic proxy can be created with out interface implementation too).
If i have to choose among jdk dynamic proxy implementation and cglib dynamic proxy, which is better in performance / maintainability?
How these two differ in J2SE environement and J2EE environement?
9 years ago
Make sure changing object detached from persistence context before it modified Other wise Persistence context will merge change back to database. If you are using JPA2.0, there is method called detached() which is handy to do that job.
I am using Spring StoredProcedure class to call sybase stored procedure. But i am getting below error.

Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call sts_config..FindScriptBySource(?, ?, ?, ?, ?)}]; SQL state [HY010]; error code [0]; Output parameters have not yet been processed. Call getMoreResults().; nested exception is java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952)
at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985)
at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:117)
at com.spring.jdbcexample.StoredProcedureDao.executeFor(StoredProcedureDao.java:25)
at com.spring.jdbcexample.JDBCMain.main(JDBCMain.java:34)
Caused by: java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at net.sourceforge.jtds.jdbc.ParamInfo.getOutValue(ParamInfo.java:159)


Here is my Code:

public class StoredProcedureDao extends StoredProcedure{
public StoredProcedureDao(JdbcTemplate template){
super(template, "sts_config..FindScriptBySource");
declareParameter(new SqlParameter("sourceCode", Types.VARCHAR));
declareParameter(new SqlOutParameter("sourceCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("scriptCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("exprDate", Types.DATE));
declareParameter(new SqlOutParameter("scriptText", Types.VARCHAR));
compile();
}
public String executeFor(String sourceCode){
Map input=new HashMap();
input.put("sourceCode", sourceCode);
Map output=execute(input);
StringBuffer obj=new StringBuffer();
obj.append((String)output.get("sourceCd"));
obj.append((String)output.get("scriptCd"));
obj.append((String)output.get("exprDate"));
obj.append((String)output.get("scriptText"));

return obj.toString();
}
}

Please any one help me, why i am getting this error?

Thanks
Pavan.
I am using Spring StoredProcedure class to call sybase stored procedure. But i am getting below error.

Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call sts_config..FindScriptBySource(?, ?, ?, ?, ?)}]; SQL state [HY010]; error code [0]; Output parameters have not yet been processed. Call getMoreResults().; nested exception is java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952)
at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985)
at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:117)
at com.spring.jdbcexample.StoredProcedureDao.executeFor(StoredProcedureDao.java:25)
at com.spring.jdbcexample.JDBCMain.main(JDBCMain.java:34)
Caused by: java.sql.SQLException: Output parameters have not yet been processed. Call getMoreResults().
at net.sourceforge.jtds.jdbc.ParamInfo.getOutValue(ParamInfo.java:159)


Here is my Code:

public class StoredProcedureDao extends StoredProcedure{
public StoredProcedureDao(JdbcTemplate template){
super(template, "sts_config..FindScriptBySource");
declareParameter(new SqlParameter("sourceCode", Types.VARCHAR));
declareParameter(new SqlOutParameter("sourceCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("scriptCd", Types.VARCHAR));
declareParameter(new SqlOutParameter("exprDate", Types.DATE));
declareParameter(new SqlOutParameter("scriptText", Types.VARCHAR));
compile();
}
public String executeFor(String sourceCode){
Map input=new HashMap();
input.put("sourceCode", sourceCode);
Map output=execute(input);
StringBuffer obj=new StringBuffer();
obj.append((String)output.get("sourceCd"));
obj.append((String)output.get("scriptCd"));
obj.append((String)output.get("exprDate"));
obj.append((String)output.get("scriptText"));

return obj.toString();
}
}

Please any one help me, why i am getting this error?

Thanks
Pavan.
Thanks Tom. this is my coding mistake, i have used request object instead of session object to lookup the user object. Once again thanks for help.
11 years ago
I am New to struts2 framework. I have created a login interceptor which will intercept every action to make sure user object in session, if not, redirect to login page or creates user if request coming from login page.

My Interceptor Code :
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("Interceptor method calling...");
final ActionContext context=invocation.getInvocationContext();
HttpServletRequest request= HttpServletRequest)context.get(HTTP_REQUEST);
HttpSession session=request.getSession(true);
Object user=request.getParameter(USER_HANDLE);
if(user==null){
String loginAttempt=null;
loginAttempt=(String)session.getAttribute(LOGIN_ATTEMPT);
if(loginAttempt==null){
if (processLoginAttempt (request, session) ) {
return "login-success";
} else {
Object action = invocation.getAction ();
if (action instanceof com.opensymphony.xwork2.ValidationAware) {
((com.opensymphony.xwork2.ValidationAware) action).addActionError ("Username or password incorrect.");
}
}

}
return "login";
}else{ //user already logged in ..continue with requested
return invocation.invoke();
}
}

private boolean processLoginAttempt(HttpServletRequest request, HttpSession session) {
String username = request.getParameter (USERNAME);
String password = request.getParameter (PASSWORD);
Object user = SecurityManager.login (username, password);
if (user != null) {
session.setAttribute (USER_HANDLE, user);
return true;
} else {
return false;
}
}

My Interceptor stock:
<interceptor name="login" class="com.struts.interceptor.login.LoginInterceptor"/>
<interceptor-stack name="defaultLoginStack">
<interceptor-ref name="servlet-config" />
<interceptor-ref name="params" />
<interceptor-ref name="login" />
<interceptor-ref name="prepare" />
<interceptor-ref name="chain" />
<interceptor-ref name="model-driven" />
<interceptor-ref name="fileUpload" />
<interceptor-ref name="static-params" />
<interceptor-ref name="params" />
<interceptor-ref name="conversionError" />
<interceptor-ref name="validation" />
<interceptor-ref name="workflow" />
</interceptor-stack>
My Actions :
<action name="ShowLogin">
<result>/jsp/login.jsp</result>
</action>
<action name="displayAllBranches" class="com.struts.action.organization.BranchAction" method="getAllBranches">
<result name="success">/jsp/branchList.jsp</result>
</action>
For every request my interceptor calling properly, but it couldn't find the USER_HANDLE attribute in session after second action call so returning to login page. i am not able to figure out why my session attribute removing from value stack? Any clue would be greatly appreciated.
11 years ago