Punya Pratap Singh

Ranch Hand
+ Follow
since Nov 23, 2010
Merit badge: grant badges
For More
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 Punya Pratap Singh

Hi All,

I am creating a Database connection pool in my application(With Tomcat Server). I am using org.apache.tomcat.jdbc.pool. but my applications requirement is to configure databse connection pool properties in external xml file (I can not use server.xml or context.xml).I am configuring pool configuration in custom xml file and put it in tomcat/conf/appname/appname.xml file
I am doing it so that we can change data base configuration at runtime with out restarting the server.



I have created connection pool in contextInitialized() method. and using DataSource I am getting connections from this database pool.
But everytime if I make multiple requests to application. it sometimes give "pool exhausted exception", connection is already closed or Timeout: Pool empty. Unable to fetch a connection in x seconds, none available.
But if I use tomcat context.xml, it doesn't give any error and works well for multiple requests.

I am closing ResultSet, Statement and connection objects properly in the code.
Also I have read somewhere that I am closing proxy connections not real connection .


Please help me.



Hi All,

I want to use JDK1.7 and JDK1.6 for different projects on my workstation. but when I install both JDK 1.7 supersedes and 1.6. I have set environment variables accordingly, but it doesn't seem to work.
Can you please help me to do it. I need to work on both projects at the same time one is using 1.6 and another 1.7.


Thank You.
8 years ago
below is the code in my jsp file. I am using below code above <table> element and it displays all the form errors above table like below -

State is required.
First Name is required.
Last Name is required.
but I want to show it in a alert box instead of showing it on page itself.



Above code shows all the binding errors of form above table element, used in form.
I need to display all those errors in a alert box for some reason.
I am using <form:form> tag of spring.
xyzOrder is command name.

Please help me.
10 years ago
I have created ManyToMany mapping in hibernate. like below -





Test class -


It runs perfectly and creates Vehicle, UserDetails, UserDetails_Vehicle and Vehicle_UserDetails tables.
when I issue select command, all tables except UserDetails_Vehicle shows the table data.
But when I issue select command for UserDetails_Vehicle it says - "UserDetails_Vehicle" table data is not editable because there is no primary key..

Please help me understand why is this happening.
I am using MySql data base and issuing select command in query browser of it to see the table contents.

Thanks a lot.
You mean to say that if we don't use "new" for Base class object externally, then implicit call from sub class constructor to super class constructor will only create object of type subclass. As I know implicit "super" call from subclass will first create a super class object?
10 years ago
I thought Answer should be "superclass" and 9.0 but when debugged it printed 0.0 and 9.0. Please explain why?
10 years ago
10 years ago
Hi All,

I am new in hibernate, I need to complete a task in which I have to pick the data from 3 tables.
table one - fields
1-CUSIP
2-LIPPER_CAT(id)

table 2 - fields

1-LIPPER_CAT
2-UBS_CAT_CD(id)

table 3 - fields
1-UBS_CAT_CD
2-UBS_CAT_DS
3-UBS_SEQ
so I will use first table ID to make join with 2nd table and 2nd table id for making join to 3rd table.
Just for example - I am using following code if I have to pick data from only one table that is -LipperAstCat
code is as follows-

LipperAstCatDAO lipperAstCatDAO = ((LipperAstCatDAO)getDAO("LipperAstCatDAO"));
String hql = "from LipperAstCat ";

Session session = lipperAstCatDAO.getSessionFactory().openSession();
Query query = session.createQuery(hql);
ArrayList<LipperAstCat> ssFundAstCat = (ArrayList<LipperAstCat>)query.list();
session.close();

return ssFundAstCat;

LipperAstCat table has two files in this so I am using a bean class(with getter setters) and LipperAstCatDAO class from where I am getting session.
I have a persistence.xml file which is having
<property name="mappingResources">
<list>
<value>
com/hewitt/websolutions/emp/persistence/hibernate/LipperAstCat.hbm.xml
</value>
</list>
</property>

In the same xml file I have mapping like this

<bean id="LipperAstCatDAO"
class="com.hewitt.websolutions.emp.persistence.hibernate.dao.LipperAstCatDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

LipperAstCat.hbm.xml has LipperAstCat table mapping.
and I am getting data comfortably.

So In join sceniro how would I do all this to get data.
Can you please help me in this ? Thanks.
I am using following version of eclipse.
and it gives me compile time error that - the import org.apache.commons.lang.builder.ToStringBuilder not resolved.

Eclipse Java EE IDE for Web Developers.

Version: Indigo Release
Build id: 20110615-0604

(c) Copyright Eclipse contributors and others 2005, 2011.


I am not very much aware of using eclipse.please help me.
The code is same as above.that is why I posted it here.
Now It is giving following Exception ,What could be the possible causes,
Please Help me.


Thanks a lot Both of you.
Actually I was in impression that you can not create any inner class instance without using inclosing class instance.so I did not tried for that.



12 years ago


Prints value "10" as assigned with value "10" in ChangeVal method.
but in below code same procedure is being done but it does not accepts the assignment in populateArray() function and
prints "0" for all indexes.
If we populate the array in Testing class's constructor then it prints all the values .why ?


12 years ago
Hi,

Now when I try to connect with following connection string it throws following Error.And I am using windows authentication.