sawan parihar

Ranch Hand
+ Follow
since Aug 24, 2004
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 sawan parihar

I found the sol. Just in case someone might encounter this here is the sol:

Not sure this is the right way but it works.

For SQLServer the query should have been like:

select * from schema..image

Now i specified the default schema name in file:

The schema name is 'schema' but note that '.' after the schema name. Without the '.' hibernate query will be select * from Just one '.' this won't work. I need two '.' and I specified one in the properties file.

This is how it works.

[ August 01, 2007: Message edited by: sawan parihar ]

The table does exist.
It just came to my mind that the problem is the schema name .
I am using BasicDataSource to connect and not sure how can I specify the schema name.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
<property name="driverClassName>
<property name="url">
<property name="username"><value>admin</value></property>
<property name="password"><value>password</value></property>

the query should have been something like this:

select * from schema..Image as Image.

Any idea how can I specify the schema name?

[ July 31, 2007: Message edited by: sawan parihar ]

Env: Spring,Hibernate, SQLServer

I am trying to fetch the records from "Image" table. My query is pretty simple:
public List getAll() {
return getHibernateTemplate().find("from Image");

But the query that hibernate generates is:

select image0_.UID as UID0_ from Image image0_

Exception trace:
SEVERE: Invalid object name 'Image'.
Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.listIgnoreQueryCache(
at org.hibernate.loader.Loader.list(
at org.hibernate.loader.hql.QueryLoader.list(
at org.hibernate.hql.ast.QueryTranslatorImpl.list(
at org.hibernate.engine.query.HQLQueryPlan.performList(
at org.hibernate.impl.SessionImpl.list(
at org.hibernate.impl.QueryImpl.list(
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(
at org.springframework.orm.hibernate3.HibernateTemplate.execute(
at org.springframework.orm.hibernate3.HibernateTemplate.find(
at org.springframework.orm.hibernate3.HibernateTemplate.find(
at sawa.parihar.database.HibernateTestDAO.getAll(
at sawa.parihar.database.HibernateSpringTest.test(
at sawa.parihar.database.HibernateSpringTest.main(
Caused by: Invalid object name 'Image'.
at Source)
at Source)
at Source)
at Source)
at$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
at Source)
at Source)
at Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(
at org.hibernate.jdbc.AbstractBatcher.getResultSet(
at org.hibernate.loader.Loader.getResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
... 14 more

Any help is highly appreciated.

you always call method on the stub and not on the remote object.

That means , rule of thumb is that Bean cant access any of its client,isinit?

Depends upo the question. If it is written that the client is a java client that the question will be more confusing. But in the above case its not written that client is a java client.

Why B is correct?

Because R is remote and B has local interfaces.

hope it helps.
R is the client and that is why B cannot invoke methods on the client. The question is not very clear but it depends how you interpret it. The client can be anything.. no java .. right ... that means B can't invoke the methods.

Hope it helps.
The question says choose two option that means a and d are correct. Also if it is about stateful session bean then a,d,f are correct. But it't not written that its for stateful session bean.


I don't see why this code would throw an exception, please enlighten me...

The exception will be thrown because we are trying to commit a transaction that is alreday marked for rollback. It will be helpful if for example we consider weblogic. It throws AppSetRollbackOnlyException to indicate that a transaction was marked for rollback by an application component.

Hope it helps.
Hello bhila,

g)Upon execution of this code, the container ensures that the transaction is not committed

If the transaction is already marked for rollback then container will make sure that it will never commit. This makes the option g correct.

d This code will throw an exception at runtime.

This is also correct. Most of the container will throw error in this case. But then it again depends upon the container implementation. In case of weblogic "AppSetRollbackOnlyException" will be thrown. I am not very sure that what specs say about this but I believe that its upto the container provider.

Hope it helps.
If you are familiar with EJB technologies then you can go for SCBCD. Also would like to add that for SCBCD (H&F+ Specs) is enough to score above 90%.

Best of Luck.
[ August 12, 2005: Message edited by: sawan parihar ]
The environment entries can be set by bean provider,app assembler or the deployer. I believe that 3 is right.

is it required that the class shoudl have instane variables as public or is it suffciet it has public accessor methods for the instances.

Yes the class should have public fields.

my question is what if it goes through ejbActivatre?
in that case, ejbCreate, ejbPostCreate will not be called

Yes ejbCreate, ejbPostCreate will not be called in the above case.

ejbCreate, ejbPostCreate will be called when you are creating the entity bean whereas ejbActivate() is called to activate the entity bean that is already created.

so does ejbActivate should set the cmp, cmr fields

No. As the bean is already created there is no need to set the values.
SCBCD 1.3 requires ejb 2.0