Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Chandra Sekhar

Ranch Hand
+ Follow
since Sep 26, 2003
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 Chandra Sekhar

"Inheritance allows you to restrict the behavior of objects."

Is this statement correct. Please calrify.

Thanks
Hi,

Version of Portal Server is 6.0

I'm getting ClassCastException. Thats where i'm stuck.




Anyway i'll check the logs again.

Thanks
[ July 08, 2008: Message edited by: Chandra Sekhar ]
13 years ago
Hi,

I'm trying to deploy an application devleoped using JSF-Portal combitaion intially developed for WebSphere Application Sever (WAS) 5.1 on WAS 6.0.

For JSF we are using MyFaces-Tomahawk implemention version 1.1.5.

Also now I'm using RAD 7.0 for development. Initially I got exceptions related conflict between to JSF RI and My Faces implementation.

Then I followed the steps here http://wiki.apache.org/myfaces/Websphere_Installation and remvoed jar files from WAS.

My Portlet class is like as below

public class MyPortlet extends MyFacesGenericPortlet { /// }

Now I'm getting ClassCastException.



Please help me to resolve this issue.

Thanks
Chandra
13 years ago
I'm not sure whether this will solve your problem.

To set default value to a column , I had done like this before.

<property name="price" type="string" formula="CASE WHEN (COALESCE(ITEM_CST,0) = 0) THEN ' ' ELSE CHAR(ITEM_CST) END"/>
Hi,

addClass will try to read a mapping from an application resource, using a convention.

Ex.The class foo.bar.Foo is mapped by the file foo/bar/Foo.hbm.xml.
Hi,

When i changed my version to hibernate3.2 its working.


Thanks
Chandrasekhar S
Hi,

While triying to execute an update query using native SQL ,i'm getting an exception as follows.

java.lang.UnsupportedOperationException: Update queries only supported through HQL at org.hibernate.impl.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:607)

My code is like



I can change to HQL, but I like to know why this exception is thrown.

Why is native SQL for update not supported by Hibernate.

Thanks in Advance
Chandrasekhar S
Hi,

I need to show tool tip for 'select' component in my HTML page.
Here is my code.



But Tool tip is not shown in Internet Explorer.But its working fine in Fire Fox.I'm working with IE 6.

Is this a known issue.Please let me know if there is any work around for this.

Thanks In Advance
Chandrasekhar S.
Hi

You can run some obfuscator tools to prevent reverse engineering.

This may help you

http://proguard.sourceforge.net/
15 years ago
Hi,

Please help me in writing HQL delete query.

My entity Class is like this


public class FunctionResourcePermissionData implements java.io.Serializable {
// Fields
private FunctionResourcePermissionId id;
private CompositeResourceData resourceObject;
private FunctionData function;
private String permissionCode;
private Date recordCreationTimestamp;
private String recordCreationUserId;
private Date lastUpdateTimestamp;
private String lastUpdateUserId;


The Id class is


public class FunctionResourcePermissionId implements java.io.Serializable {
// Fields
private Integer elementaryResourceId;
private Integer compositeResourceId;
private Integer functionId;


Mapping file is as below.

[/b]
<hibernate-mapping>
<class name="com.xxx.yyy.zzz.data.application.entity.FunctionResourcePermissionData" table="FUNC_RSRC_PRMSN">
<composite-id name="id" class="com.xxx.yyy.zzz.data.application.entity.FunctionResourcePermissionId">
<key-property name="elementaryResourceId" type="integer">
<column name="RSRC_ID" />
</key-property>
<key-property name="compositeResourceId" type="integer">
<column name="CMPST_RSRC_ID" />
</key-property>
<key-property name="functionId" type="integer">
<column name="FUNC_ID" />
</key-property>
</composite-id>
<many-to-one name="resourceObject" class="com.xxx.yyy.zzz.data.application.entity.CompositeResourceData" update="false" insert="false" fetch="select">
<column name="CMPST_RSRC_ID" not-null="true" />
<column name="RSRC_ID" not-null="true" />
</many-to-one>
<many-to-one name="function" class="com.xxx.yyy.zzz.data.application.entity.FunctionData" update="false" insert="false" fetch="select">
<column name="FUNC_ID" not-null="true" />
</many-to-one>
<property name="permissionCode" type="string">
<column name="PRMSN_CD" length="10" not-null="true" />
</property>
<property name="recordCreationTimestamp" type="timestamp">
<column name="RCRD_CRTN_TMS" length="26" not-null="true" />
</property>
<property name="recordCreationUserId" type="string">
<column name="RCRD_CRTN_USR_ID" length="8" not-null="true" />
</property>
<property name="lastUpdateTimestamp" type="timestamp">
<column name="LST_UPDT_TMS" length="26" not-null="true" />
</property>
<property name="lastUpdateUserId" type="string">
<column name="LST_UPDT_USR_ID" length="8" not-null="true" />
</property>
</class>
</hibernate-mapping>
[/b]



The query i wrote to delete is as


getSessionFactory().getCurrentSession()
.createQuery("delete from FunctionResourcePermissionData " +
" where id.elementaryResourceId=:elemRes" +
" and id.compositeResourceId=:compRes " +
" and id.functionId=:fnId")
.setInteger("elemRes",fId.getElementaryResourceId().intValue())
.setInteger("compRes",fId.getElementaryResourceId().intValue())
.setInteger("fnId",fId.getElementaryResourceId().intValue())
.executeUpdate();



I'm getting the following exception
org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:99)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:871)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at com.xxx.yyy.zzz.data.application.dao.hibernate.AuditLogDAOImplTest.testDelete(AuditLogDAOImplTest.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/LINUX] SQL0206N "FUNCTIONRE0_.RSRC_ID" is not valid in the context where it is used. SQLSTATE=42703

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)
... 18 more




The query generated by hibernate is

Hibernate: delete from EPDS.FUNC_RSRC_PRMSN where functionre0_.RSRC_ID=? and functionre0_.CMPST_RSRC_ID=? and functionre0_.FUNC_ID=?

In the query the alias name functionre0_ is not there after the table name ,but before field names the alias name is added.

Can some one help me to solve this issue.

Thanks in Advance
yes its "Our" group.

Chandra
hi Santhosh,

Include me also in your study group.I do have copy of HFSJ.

Chandra Sekhar

Originally posted by Satou kurinosuke:
I think that it is to support older version (JSP1.1) where there was no hyphen.



Thanks for your reply.

What abt short-name ,thats also optional now in 1.2 rght?

thanks again
Chandra
Please calrify my doubts

(1)In http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
the 'taglib' element XML descrpition is given as

<!ELEMENT taglib (tlib-version, jsp-version, short-name,
uri?, display-name?, small-icon?, large-icon?,
description?, validator?, listener*, tag+) >

Here short-name is mandatory,but my TLD works with out that.Is
short-name attribute not mandatory?

(2) As per the 'tag' element description

<!ELEMENT tag (name, tag-class, tei-class?, body-content?,
display-name?, small-icon?, large-icon?,
description?, variable*, attribute*, example?) >

the element name is tag-class & body-content, but
tagclass,bodycontent (with out hyphen) also works.I'm sure something really wrong in my understanding as i'm not good in XML.
(i'm working in Tomcat 5).Please clarify my doubts.


Thanks In Advance
Chandra