Devesh Chanchlani

Greenhorn
+ Follow
since Sep 04, 2007
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 Devesh Chanchlani

Yes, my hibernate.cfg.xml is as follows:

Cannot make out the cause of the error. The realted files are attached below...

SoundTracks.hbm.xml


com.db.Soundtracks


Error Message
[ com.common.ExceptionLogger , log , 25 ] org.hibernate.MappingException: Association references unmapped class: com.db.Soundtracks
[java] at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2399)
[java] at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2678)
[java] at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
[java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1163)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1319)
[java] at com.common.BollyDBHibernateFactory.rebuildSessionFactory(BollyDBHibernateFactory.java:84)
[java] at com.common.BollyDBHibernateFactory.getSession(BollyDBHibernateFactory.java:57)
[java] at com.db.DAODAO.getSession(MoviesDAO.java:29)
[java] at com.db.DAODAO.persist(MoviesDAO.java:47)
[java] at DeserializerTest.main(DeserializerTest.java:95)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:747)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:201)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:104)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:623)
[java] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:456)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[java] at java.lang.reflect.Method.invoke(Unknown Source)
[java] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
[java] at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate.runInSameVM(AntLaunchDelegate.java:266)
[java] at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate.launch(AntLaunchDelegate.java:228)
[java] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:764)
[java] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:614)
[java] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:607)
[java] at org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder.launchBuild(ExternalToolBuilder.java:179)
[java] at org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder.doBuildBasedOnScope(ExternalToolBuilder.java:167)
[java] at org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder.build(ExternalToolBuilder.java:86)
[java] at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:633)
[java] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
[java] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
[java] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
[java] at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
[java] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
[java] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
[java] at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
[java] at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
[java] at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:330)
[java] at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:182)
[java] at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Thanks in advance.
Resolved the issue, just needed to change the ant script in the following manner:

<target name="compile" depends="prepare" description="Normal build of application">
<javac srcdir="src" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source">
<classpath refid="compile.classpath"/>
</javac>
</target>
Problem description: Getting "?" in place of line numbers, while logging with log4j. All other parameters are working. The details are given below:

Log4j.properties


Test.java


OUTOUT
[java] 2009-03-02 03:39:48 [ Test , main , ? ] DEBUG => LOGGER WORKING !!!


Thanks in Advance.
Hi Berts,
I am reading the book HF Design Patterns & its really great. This query is regarding the Singleton Pattern.
According to GOF, there is an even other way of subclassing a Singleton object, using Hashtable. The correspong code is as follows:


But I still do not have the clarity as to what is the utility of thias code.
Please throw some light. Also, was even more curious, as this has not been covered in HFDP.

Thanks in advance.
Devesh Chanchlani.
SCJP Aspirants can even refer to this article, which covers minor deatils which are often missed by the aspirants. Below is the URL:
SCJP 5 Preparation (Tips, Tricks & FAQs)

Keep Going...
Hi Vishal,

byte [][] b = new byte[2][1];

the code simply means that you are creating a single double-dimension array, having 2 rows, with one element each(and not 2 different arrays). Think of a 2 dimensional array(in this case) as a 2*1 matrix.

Thanks.
You can refer to the core SCJP concepts in more coarse level at:
SCJP Coarse Concepts
[ May 05, 2008: Message edited by: Devesh Chanchlani ]
Hello Everybody,
I passed SCJP 5.0 with 97%. Thanks to all those who participate so actively in this forum.

Devesh Chanchlani.

Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed.
15 years ago
Hello Everybody,

I need to modify the login-config.xml dynamically. According to my requirement, I need to modify the "java.naming.provider.url" module-option of the LdapLoginModule in the login-config.xml, dynamically.
Can this be done using the DynamicLoginConfig service ?
Please provide any workaround.

Thanks.
-------------------
Devesh Chanchlani
-------------------
16 years ago
Sorry for the delay in reply, as I was not working on this issue for quite sometime.
I tried a number of work-arounds for the previous code, but to no success. So I have got back to the conventional way of using saveOrUpdate, as follows:

Session session = this.getSession();
session.beginTransaction();
session.load(VulTable.class, transientInstance.getId());
session.saveOrUpdate(transientInstance);
session.getTransaction().commit();

But still I have the same problem, ie after 2/3 updates, the data fetched is not the latest.
I think it has got to do with the hibernate session, which does not always gets updated (or stops updating after few updates are made continuously).

Also there's another thing which I have noticed. I performed a small test. Just after the transaction is committed, and I try to fetch the data using the id(using findById function in the DAO), I get the appropriate data.
[I call the findById function from the saveOrUpdate function of the DAO itself, after the transaction is committed.]
But, when I try to fetch the data from the Action class of the UI, using the same findById function of the DAO, I dont always get to see the latest data.

Also, I have tried with both JDBC and JTA transaction, but have the same problem.

Please suggest.

==================
Devesh Chanchlani
==================
"The best ammunition is a load of ambition fired with effort towards a definite goal."
Hi Ganesh,

I regret, its my mistake. The function used is "Query.setParameterList".

All you need to do is, for the IN clause, in the named query or HQL query, specify the parameter as "IN ( aram )", and set the parameter in your DAO method using query.setParameterList("param", paramList);

The paramList variable could be any List/Set.

Sorry for the inappropriate prior information.

=====================
Devesh Chanchlani.
=====================

"A positive attitude may not solve all problems, but it'll annoy enough people to make it worth the effort."
Thanks for your reply.
There was a where initially, which I apparently missed out.The problem however got resolved.
The mistake was, I was setting the bind parameters using the setBingParameter funtion instead of setBindParameterList.

====================
Devesh Chanchlani.
====================
Hello Everybody,

I am using a namedQuery in Hibernate for Count having IN clause, as follows:

SELECT COUNT(*)
FROM table1
col1 IN ( :List1 ) AND
col2 IN ( :List2 )

I am providing the bind parameters as java.util.List.
Still I donot get any result or even any exception.
I am using Hibernate 3.
Will Hibernate not support a Count query with IN clause having bind parameters ?

=====================
Devesh Chanchlani
=====================

"The journey of a thousand miles begins beneath one's feet."
Hi Mark,

If there would be a problem with the data object I m returning, then I would have never got the updated results. for the first few updates, generally 2 or 3, I get the appropriate values, but after this if I make any further updates, I do not get the proper updated result back on the front-end.

Please suggest any work-around...

-----------------
Devesh Chanchlani
-----------------

"The journey of a thousand miles begins beneath one's feet."
Hello Everybody,

The problem I m facing is probably due to the hibernate cache. The problem exists in the form which queries 2 tables to fetch the data. The update opration is performed in the same form. After update, the form needs to show the updated data. But, after 2 or 3 updates, the data fetched doesnot contain the currently updated values, rather contains the previously updated values. The updated values are not shown even when the page is refreshed manually through the browser. Although the DB tables get updated. Its only when the data is re-queried, that the page reappears to show the updated results.

Additional Information that may help:
1) Hibernate version 3.0 being used with JBOSS server
2) the 2 tables have 1:n mapping
3) Update operation is being implemented as follows:



4) Second Level Cache is not enabled
5) Query Cache is enabled

Hoping to find a quick solution.......
------------------
Devesh Chanchlani.
------------------
[ October 17, 2007: Message edited by: Mark Spritzler ]