vikasids sharma

Ranch Hand
+ Follow
since Aug 01, 2003
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 vikasids sharma

Pallu Sagar wrote:Please chk your table relationship..seems to be strange for me..nyways...

About relationship , the system is like user cannot exist without organisation....

If your query has select clause then you cant get 'Organisation' object resultset... query would return you a resultset...
Then you have to write your own QueryResutSet mapper for mapping / binding...

Sorry , i did nt understand that i cannot get my Entity Object by using SELECT clause .
Can you please provide me example where we fetch selected attributes from two related tables and getting back an Entity as result of uniqueResultset?

Simple way to do is remove select clause and identify your fetching strategies...and apply those on collection

Hi All

I have a table structure like
Organisation (has userId as FK from OwnerDetail)
OwnerDetails (Organisation id as FK)


I want to fetch an organisation along with the owner by using hibernate . The situation is like i want to retrieve few attributes from Organisation and few from OwnerDetails .
I am using query.uniqueResultset() which returns me an Object but i expect it to be my Entity (Organisation).

When i try to type cast returned Object to Organisation , i m getting ClassCast Exception.

Please let me know how can i get back my Entity with only selected attributes populated.


Thanks
Vikasids

Paul Sturrock wrote:You will need to define a version property in your mapping then it should just work.



Hi Paul

Thanks for your reply . Can you please provide a bit insight like how it works.
HI all

I am using spring hibernate for my application .
I guess hibernate performs automatic dirty checking for any updates.
In my case even if i dont update/modify object , i could see lot of updates on my console (for complete graph of bject) on submission of form.

Please let me know if need to do any thing explicitly to have dirty checking feature.

IN my applicationContext , I am using ..

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">

<list>
<value><my .hbm files></value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>

<!-- The Hibernate interceptor -->
<bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
</bean>

<!-- Hibernate Transaction manager -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- Bean Configuration for the HibernateTemplate-->
<bean name="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>


<bean id="myDao" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="MyDaoImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
</property>
<property name="proxyInterfaces">
<value>MyDao</value>
</property>
<property name="interceptorNames">
<list>
<value>hibernateInterceptor</value>
</list>
</property>
</bean>


Thanks
Vikas
Interface

Interface for Real World Development


Cheers
Vikas
14 years ago

Campbell Ritchie wrote:Depends where else the Statement object is referred to from. The real problem is that you might not close the statement if it is not in a finally block.



Hi Ritchie


Ok, i close the statement in finally block but could not ignore the fact that statement.close() actually failed in database , i am taking it as database driver failed to dis-associate cursor from statement . But marking that statement explicitly afterwards as NULL would help to reclaim memory?
Would there be any consequences in application from database point of view?

Thanks
Vikas
14 years ago
Hi All
I have created a Prepared Statement for selecting records from database.
After using the statement i have closed it in try catch block .
Outside the catch block , i marked statement as NULL.

Now lets say , statement.close() fails and exception is simply logged (havnt took any action on failure) .
Would that statement object be picked by Garbage collector for reclaiming memory ?

Thanks
Vikas
14 years ago

Originally posted by Peter Chase:
What does %foo% mean?.[/QB]
It means searching all names having foo as part of name.

Do you want to search with Java or with Oracle (i.e. SQL)? It's not clear from your post



I want to search from java .Target database is oracle .
16 years ago
Hi all
Can any body suggest best algorithm from performance point of view for wild card search. The search critiera is of type %foo% and target table in oracle has size order of 10,00,000 records.

Thanks
16 years ago
Hi All

Can we lock the file for reading-writing i.e if one java program reads the file and no other program could read before the first program complete writing it.

Thanks
Vikas
16 years ago
Thanks Rahul and Ramko..

Issue with GUID is , it creates number with approx 32 digits .
I have to take into consideration max Length as 10 and if i try to manipulate the lenght of GUID generated number , i will loose uniqueness

Originally posted by Remko Strating:
You could create an uniqueId by using the nano time



It will only work with jdk 1.5.

16 years ago

Originally posted by Paul Sturrock:
Will a UID do?



Actually same code has to be used on multiple JVMs . So i believe UID wont work .Because these Unique id(s)will be persisted in same storage. Moreover approx 10,000 id(s) need to be created from each box(JVM).

Thanks
Vikas
16 years ago
Hi All
I want to create Unique Id(s) and as far as requirement is concerned , java program should create every time a unique number. Could some body help me to provide parameters which could be used to create Unique numbers.


Thanks
Vikas
16 years ago
Hi Dande

I m working on core java application,its not web application.

Originally posted by Wagner Danda:
Hi Vikas,

take a look at Struts Validator: http://struts.apache.org/struts-doc-1.2.4/userGuide/dev_validator.html

Best regars,
Wagner Danda

Hi Every body

I m working on a core java client/server application for Stock Exchange.
I need to validate the data on server before it is processed for persistence .I need a framework where i can modify/ add new validations. Actually requirements are like at some situations we could have different set of validations for respective request from client .

Thanks
Vikas