Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

vishwa venkat

Ranch Hand
+ Follow
since Nov 22, 2003
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 vishwa venkat

Here is more info-

First i go to list screen where I display all employees foa department using-

Query query = currentSession.createQuery("from Employee v where v.deptId=" + deptId);
List<Employee> retList = query.list();

Next I go to particular employee by another query-
Query query = currentSession.createQuery("from Employee v where v.empId=" + empId);
Employee v = (Employee ) query.uniqueResult();

and once the user makes changes to the employee I call update-

Employee v = (Employee ) currentSession.merge(employee);
currentSession.flush();

and then I go back to view the list of employees again-

Query query = currentSession.createQuery("from Employee v where v.deptId=" + deptId);
List<Employee> retList = query.list();

I keep refreshing the list screen sometimes I see the employee with old details sometimes with new details.

I used a HibernateSessionFilter that starts up a session on each servlet request and closes at the end of service the request.

let me know if you need any more details.. I am very confused why its behaving weird...Thanks for all your help!
I have not set any second level cache.

I am just doing-

Query query = currentSession.createQuery("from Employee v where v.empId=" + empid);

List<Employee> retList = query.list();

and what I was doing is updating one of the employee object. and when I execute the query sometimes it returns update employee in the collection and sometimes old employee in that collection.

can some one help? Thanks,
-Visu
Start with Struts Framework. and make sure you have all your database access code in DAO's exposed by interfaces. Make sure everything working fine with JDBC DAOs. and then slowly include Hibernate stuff ..hibernate.cfg.xml and mappings, HibernateUtil,..and write new implementation of DAOs using Hibernate. This will give you a chance to see how Hibernate eases development over JDBC.
Once you are experienced, you can write Hibernate code directly instead JDBC.
11 years ago
Verify what version of struts you are using 1.1. or 1.2 or 1.3.

Unzip/Unjar struts.jar and check the MANIFEST.MF in META-INF.

and make sure you have correct DTD specifier in your struts.xml
11 years ago
you should use select in this fashion-

<s:select list="couList" listKey="couid" listValue="couName" headerKey="-1" headerValue="-Select-" onchange="countrychange()"></s:select>
assuming couList is a list of Country Object having couid,couName as properties.
11 years ago
look for ant filter config for hibernate config. by which you can pass the parameters to hibernate config from ant build target.
did you try setting show_sql property in hibernate config and able to see the sql that it generated?
Did you try passing the id of the record in modify/delete links.
11 years ago
session is treated as a Map in struts2, so use the following to get it -

<s:property value="%{session['emailId']}"/>
11 years ago
Thanks for the reply.

I got cglib and asm in my classpath and here is the snippet from applicationContext.xml


<!-- A simple MethodInterceptor style advice object (InterceptorA implements MethodInterceptor) -->
<bean id="loggingAspect" class="aspects.LoggingAspect"/>


<bean name="pointcut.advisor2" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice" ref="loggingAspect"/>
<property name="mappedName" value="*"/>
</bean>


<!-- Create the proxy bean that returns AOP'd varieties of our controller -->
<bean name="myController" class="org.springframework.aop.framework.ProxyFactoryBean">

<property name="target" ref="claimService" />
<property name="interceptorNames">
<list>
<value>pointcut.advisor2</value>
</list>
</property>

</bean>

After all this, I don't see any error, but also I don't see any thing happening.Aspect is not being executed.

Do you have a sample? Thanks-
Visu
11 years ago
Is this possible?

I have tried several ways to integrate spring AOP with Struts2, with no luck. AutoProxy doesn't seem work well too. Can you guys suggest some ideas?

Thanks,
-Visu

11 years ago
Before forwarding to this page, make sure the countryList object is initialized. atleast assign an empty arraylist object. Struts2 expects to have the list being initilized in the input action class.
11 years ago
can't you use javascript DOM to populate the table with the values entered in modal popup.
11 years ago