This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Pearlo Muthukumaran

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

Recent posts by Pearlo Muthukumaran


My web application has the following flow from the servlet layer:

Servlet <--> Controller Beans <--> Application Beans <--> JDBC layer <--> DB

I am bundling all components in jar file and deploying it as single web
application. Currently, I am not using any EJB for any of the above components implementation.

Now I have a clarification. In above flow, can the Datasource JNDI configured in Apache Tomcat Server be used by JDBC Layer ? Will this approach work?

Or will I have to acquire Connection object from Datasource at Servlet Layer and pass it all the way down to JDBC Layer through controller beans and application beans?

13 years ago

I tried

session.saveOrUpdate(<object> ;<object> ;


but the behaviour has not changed. No exceptions, no additional messages and no saving of "CAT"

Thank you paul,

Here is my

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"



<property name="hibernate.connection.datasource">java:comp/env/jdbc/iDENOraDS</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</property>

<!-- Mapping files -->
<mapping resource="Cat.hbm.xml"/>



and my

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"


<class name="Cat" table="CAT">

<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="id" type="string" unsaved-value="null" >
<column name="CAT_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>

<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="name">
<column name="NAME" length="16" not-null="true"/>

<property name="sex"/>

<property name="weight"/>



If you observe hibernate.cfg.xml, I have already set show_sql=true and SQL statement I got through Tomcat console is as following:

Hibernate: insert into CAT (NAME, sex, weight, CAT_ID) values (?, ?, ?, ?)

Which is perfect.

Even I had the same doubt as that of yours as to whether Oracle supports a "uuid.hex" kind of support for id generation, so I tried changing it to Oracle Sequence (regenerated my Schema using SchemaExport tool) and changing id strategy to "sequence", still the solution did not work. It silently executes all the debug statements I had included in servlet and does not throw any exceptions and ALSO NOT STORING THE "CAT"

Any clues?

Hi all,
I have written a simple example of storing "Cat" object in the Hibernate Example. I have written the client code as foloows in the servlet:
Cat princess = new Cat();

System.out.println("Hello World 1");
Configuration cfg = new Configuration().configure();
SessionFactory sessionFactory = cfg.buildSessionFactory();
System.out.println("Hello World 2");
Session sess = sessionFactory.openSession();

Transaction tx= sess.beginTransaction();
System.out.println("Creating Cat");;
System.out.println("Committing Cat...");

All the messages are displayed in the server console properly and no exception messages are observed. But the database I cannot find the record in the database.

I have hibernate.cfg.xml and Cat.hbm.xml in the WEB-INF/classes directory and I have also placed the servlet in the same directory. I have placed hibernate2.jar and other jars appearing in lib directory of hibernate installation in WEB-INF/lib directory.

What could be the problem? Am I committing a blunder?

14 years ago
I have the following requirement of state persistence for the
mobile devices on a critical application:
1. State has to be persisted across intermittent connection and disconnection due to network coverage problems,device power cycle etc.
2. The Conversational data of session must be persisted for longer durations even across server shutdowns.
3. The session-data is highly non-relational but is more suitable for object modelling.
(eg.I have modelled the session data using a serializable Java Class.My attempt to do a relational modelling calls for additional marshalling and unmarshalling code which is a sure overhead for a wireless application)
Considering above facts,
I am planning to persist session data object graphs using object databases. I have tested an embedded object database in the above model with Tomcat Web Container and the results are promising.
I have not used easy cakes like:
a. Stateful session beans
b. JAXB kind of binding for session data
c. JavaBean <==> XML or XML <==> JavaBean
kind of solutions beacuse this is a compelling wireless application and overheads caused by above approaches, will easily kill the server.
Please advise me if my approach is having any gaping holes at the initial outset.
Thanks for the time spent on a relatively long question
14 years ago
Is MMAPI the answer?
14 years ago
Thanks Michael,
Meanwhile, I was able to gather something on AMS Push Registry of MIDP 2.0. Thats a wonderful stuff and opens up wide possibilities of applications on phones.
Aside, are there any devices in market which support MIDP 2.0 with Push registry? Are there any inhibitions for Device Manufacturers to adopt MIDP 2.0. This seems to have more attractive features than MIDP 1.0? I had the access to some device manufacturer product roadmaps. That does not seem to be very encouraging for MIDP 2.0 adoption. Any reasons for this?
14 years ago
Hi all,
Can a WMA application be run on a MIDP 1.0 Device?
My requirement is to have a SMS Listener which upon receiving
a text SMS, shall invoke a particular midlet based on the SMS
For example, if I send an SMS - "IM" to +919841028625, it will invoke a
Instant Messenger Application.
I am planning to write this SMS Listener itself as a MIdlet using WMA and
want to run it on MIDP 1.0 device.
Please clarify if I am missing something vital
14 years ago
Some makes of phones actually ROMize the Java Midlets once they are downloaded. Typically the OTA Download results in the invocation of some component called Java Application Manager and Installer in the phone. This fellow actually installs the Midlets from the JAR file downloaded and discards the Jar file.
But not all phones follow this model. Some phones may even retain the JAR file and run the midlet everytime only from Jar file.
So if your phone simply uses the jar file and also the data cable drivers allow the access and download the MIdlet jars stored in the phone, then you may have to resort to other mechanisms to prevent miuse of midlets
14 years ago
Has any one deployed and used Java Midlet on GSM Network (CSD 9.6 Kbps)?
If so please explain the effect.
I have come across cases where it is used in GPRS networks. But I have searched the net for understanding the implications of using Java Midlets on GSM CSD 9.6 Kbps networks.
All products - Nokia , Siemens etc.. claim that their Java Phons can be
used even in GSM CSD 900/1800 networks. But no practical examples and experience could be found.
I am working for a GSM Operator and I am trying to find out the possibility. Of course, there could be some pit falls on the connectivity response times to support OTA midlet downloads in GSM CSD (9.6 Kbps - Not a always-on connectivity like GPRS but the data call has to be dialled out).
Please let me know any of your experiences in above subject...
14 years ago
Hi all,
I have a single servlet which connects to internal components
(atleast 3 layers - pure Java no EJB ) and handles the client requests
I m not too sure if its important - few requests fetch CLOB from Oracle.
I am using Connection Pooling and duly relasing connections when I am done
and also when I m not done also (finally { this.releaseconnecttopool();} )so as to keep connections available for each request.... All other objects I am using are also explicitly dereferenced... NO Session varibles used....
Actually Client uses HTTPURLConnection to connect to my servlet and communicates back and forth in a stateless manner
I disabled application logging to servlet log.
1. No abnormal CPU Usage observed
2. No Abnormal memory usage observed
Now the PROBLEM:
requests. No Messages on logs too.
2. I have given some console messages. They are not displayed sometimes.
Vexed when I press Ctrl+C console messages get Printed and server
continues sometines and sometimes service is stopped
3. Config
a. Tomcat 4.1.24
b. Windows 2000
c. j2sdk1.4.0_03
Am I doing something wrong ? Please help if anybody had been in such a plight and also recovered from the same...

14 years ago
Hi all,
I am accessing the CLOB field in a table using the resultset of type ResultSet.TYPE_SCROLL_SENSITIVE. And this bean (simple bean no EJB) is accessed from a servlet. When there is a single client access for servlet, things are working fine. When I simulate a load condition at web tier by creating multiple client threads, the results become erratic and oracle.jdbc.driver.OracleDriver throws exception while scrolling through the resultset.
Though I have fixed the problem by changing the resultset type, I would like to know the reasons behind it.
Could anyone please clarify?
Your answer is true from the resultant effect point of view. But at the background, redirect results in forwarding the URL to the client and client re-requesting the URL.
- is a kind of redirect to the resource within the same server
- no client involvement is required
- as explained above
therefore, use forward when the redirected resource resides on the same server and use redirect when the resource resides on a different server
Hope this clarifies
14 years ago
Hi ,
My testing scenario for Servlet goes like this:
1. Post a XML Document as per application specs to a URL
2. Servlet interacts with the back-end components and produce a
workflow document in XML form.
The simple HTTP Client Test using URLConnection works fine and
servlet is capable of handling all relevant exceptions arising out of various semantic errors introduced in the input XML document
I am using the same setup to simulate a multithreaded test stub using URLConnection in which case very erratic behaviour is exhibited as following
1. 15 requests submitted - only 11 served
2. 15 requests submitted - only 14 served
3. 15 requests submitted - all 15 served
4. 5 requests submitted - only 3 served
5. 5 requests submitted - all 5 served
6. 5 requests submitted - only 4 served
I am puzzled. I have increased necessary database connections in the
I am not using any standard test setup like HTTPUnit (which I assume also will handle the test the same way - correct me if I am wrong)
My webserver is Tomcat 4.1.24.
Could there be any problem in the client stub or it could be a problem with the server?
14 years ago