Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

jay roy

Ranch Hand
+ Follow
since Nov 16, 2006
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 jay roy

hi guys

I am using DAO in my backend with IBATIS


I have a java value-object in which i have defined something like
public String id = null;
public BigDecimal[] access = null;
and set() methods
and get() methods

and in my IBATIS xml file, i am mapping my value object fields to table columns

like

SELECT ID_NO AS id,
PRICE AS access
FROM TABLE WHERE...

but in above sql 'access' defined as BigDecimal[ ] doesnt seem to work.

any idea if it should be access OR access.intvalue OR anything else?



any help would be greatly appreciated

thanks a lot
Jay
[ September 13, 2007: Message edited by: jay roy ]
hi guys

Not sure if this a good place to ask this question.

I am working on a J2EE application in production environment. In my j2ee websphere applicaiton server i have deployed a ear file.

I have a clustered environemnt where i have three websphere application

servers set up in cluster.The three applcation servers are named server1, server2, and
server3.
All three application servers have their own jvm and all three application servers
use a common database.
now say there is a common record in database which is accessed by three users user1, user2 and user3
and the three users are served by server1 , server2 and server3 respectively.
After user1, user2 and user3 have accessed the record, if user1 updates the record, i
want user2 and user3 to be able to see the updated record (as updated by user1).

Can anyone tell me what could be a solution to this problem.

thanks
J
hi guys

I have purchased and downloaded Whizlab software and i am using Microsoft vista Operating System. When i click on Start Exam button, the exam doesnt start. It says "Runtime error '75'.Path/File access error"

Did anyone face the same problem?

If anyone from whizlab team is looking at this question, i will greatly appreciate if you can provide me a solution.

Thanks very much
Jay
hi guys

I have implimented the HibernatePlugIn which i am starting up wheh the server starts and putting the
sessionfactory in context like this:

_factory = configuration.buildSessionFactory();
context.setAttribute(SESSION_FACTORY_KEY, _factory);

(where context is ServletContext)

Now , in my DAO Implimentatio class, how do i get sessionfactory?

public class TestDaoImpl implements TestDao
{
public TestReturnVO getInfo(String userId)
{
try
{
Session session = how do i get sessionFactory here??

}
catch{}
}
}
hi guys

I am using DAO with hibernate in my persistance layer.

but my requirment is such that inside the DAO implimentation class i want to make use of two datasources.

thi is my DAO

public class TestDaoImpl implements TestDao

{
public TestReturnVO insertInfo(TestVO testVO)
{

System.out.println("INSERT INFO INTO TABLE1 OF 'DATABASE1' using Hiberante datasource ");
return TRVO;
}


public TestReturnVO retrieveInfo(TestVO testVO)
{

System.out.println("Retrieve INFO FROM TABLE1 OF 'DATABASE2' Using Hiberante datasource");
return TRVO;
}


}

Any idea how i should go about implimenting the above scenario? Do i use abstract factory design pattern in my DAO to connect to Multiple databases?

How should i change the hibernate configuration file so that it can use two datasources instead of one?

any implimentation code would be greatly appreciated

thanks
Jay
well, i found the solution

thanks
J
hi guys
this must be simple, but i am new to this filed.

This is my xml file in hibernate

<hibernate-mapping>

<class name="com.aoc.judiciary.framework.ValueObjects.TestVO" table="FMT_CASEADR">
<id name="userId" column="ATTYID">
<generator class="native"/>
</id>

<property name="ssn" column="ATTYCASESEQNO"/>
<property name="name" column="ATTYCASESTREET"/>

</class>


<sql-query name="getParties">
<return alias="ResultSet" class="com.aoc.judiciary.framework.ValueObjects.TestVO"/>
Select * from DBWD.FMT_CASEADR WHERE ATTYID = ?
</sql-query>

</hibernate-mapping>


+++++++++++++++++++++++
Now Inside TestVO , i have only the userId field like this

public class TestVO
{

private String userId;
setuserId(), getuserId() methods

private TestReturnVO trvo; //i have another class in which i want to store the results
setTrvo() ; getTrvo() methods


}

+++++++++++++++++++++++++++++
Class TestReturnVO contains
private String ssn;
private String name;
and set() and get() for both the fields
+++++++++++++++++++++++++

Now based on the above scenario , can i modify my above xml like this:

<hibernate-mapping>

<class name="com.aoc.judiciary.framework.ValueObjects.TestVO" table="FMT_CASEADR">
<id name="userId" column="ATTYID">
<generator class="native"/>
</id>

<property name="trvo.ssn" column="ATTYCASESEQNO"/> // CHANGED to trvo.ssn
<property name="trvo.name" column="ATTYCASESTREET"/> // CHANGED to trvo.name

</class>


<sql-query name="getParties">
<return alias="ResultSet" class="com.aoc.judiciary.framework.ValueObjects.TestVO"/>
Select * from DBWD.FMT_CASEADR WHERE ATTYID = ?
</sql-query>

</hibernate-mapping>

Basically , i want to store the values from the table in a subclass object(TestReturnVO trvo)
the above code is not working and i have no idea why. any help would be greatly appreciated

thanks
Jay
hi guys

I have RSA version 6.0.0 and i am trying to upgrade to version 6.0.2. I have downloaded the fixpack which is in a zip file 6.0-WS-WAS-WinX32-RP0000002.zip
from this website:http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&uid=swg21210055
now i have extracted the zip files into the folder C:\Program Files\IBM


Now when i run the update.exe file (from updateinstaller directory) from the command prompt it says
"IBM Update Installer for websphere software is being run from an incorrect path.It must be run from <product>/updateinstaller directory where <product> is the installation location of the product to be updated

any idea what it means. I think i have to extract the zip file to someother location and not
under C:\Program Files\IBM.

any help will be greatly greatly appreciated.

thanks very much
Jay
13 years ago
thanks guys . its working now

SQLQuery sqlQuery = session.createSQLQuery("SELECT * from dbad.rst_item;");
List getSize = sqlQuery.list();
System.out.println("Size "+getSize);

tha above statements print "Size 40" in console. however

when i say something like

for (int i = 1; i < getSize .size(); i++) {
TestVO resultSet = (TestVO) getSize .get(i);
System.out.println("userID:" + resultSet.getUserId());

}

its not working, thats weird. the length is perfectly fine , but when i try to print the values , the code breaks, it says

>>>Could not invoke the service() method on servlet HibernateTestServlet. Exception thrown : java.lang.ClassCastException: java.lang.Object

any ideas?
[ May 24, 2007: Message edited by: jay roy ]
yeah, it works, its a simple select statement
select * from table;

is there any problem with the statement? i am using db2

thanks
hi guys

I am doing a hibernate excercise. I am not sure what i am doing wrong. This is what i have in my DAO

++++++++++++++++++++++++
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction trans = session.beginTransaction();
try {
SQLQuery sqlQuery = session.createSQLQuery("SELECT * from dbad.rst_item;");
List getSize = sqlQuery.list();
System.out.println("Size "+getSize);
trans.commit();

System.out.println("----------- Close the session------------- ");

session.close();
}
catch (Exception exp)
{

System.out.println("Rollback the session");
exp.printStackTrace();
// trans.rollback();
}

++++++++++++++++

This is my hibernate.cgf.xml

<session-factory>

<!-- Database connection settings -->
<property name="connection.datasource">jdbc/dwpastoreds</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.DB2390Dialect</property>
<property name="current_session_context_class">thread</property>

<mapping resource="spResourceMapping/TestVO.hbm.xml"/>

</session-factory>

+++++++++++++++++++++++++++++++++++++++++++

and this is my TestVO.hbm.xml

<hibernate-mapping>

<class name="com.aoc.judiciary.framework.ValueObjects.TestVO" table="RST_ITEM">


<id name="userId" column="1">
<generator class="native"/>
</id>
<property name="name" column="2"/>
<property name="city" column="3"/>

<property name="ssn" column="4"/>
<property name="dob" column="5"/>


<property name="extradbmappingfield1" column="6"/>
<property name="extradbmappingfield2" column="8"/>
<property name="extradbmappingfield3" column="9"/>
<property name="extradbmappingfield4" column="10"/>
<property name="extradbmappingfield5" column="13"/>
<property name="extradbmappingfield6" column="14"/>
<property name="extradbmappingfield7" column="15"/>
<property name="extradbmappingfield8" column="16"/>

</class>




</hibernate-mapping>

and i get this exception

>>>>>>>>>>>>>>>>>>>>>>>>>>
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:231)
at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1677)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at com.aoc.judiciary.framework.daoImpl.TestDaoImpl.insertInfo(TestDaoImpl.java:83)
at com.aoc.judiciary.framework.ejb.BeantestingBean.saveInfo(BeantestingBean.java:64)
at com.aoc.judiciary.framework.ejb.EJSLocalStatelessBeantesting_f63227a0.saveInfo(EJSLocalStatelessBeantesting_f63227a0.java:29)
at com.aoc.judiciary.framework.delegateImpl.LocalTestDelegateImpl.saveInfo(LocalTestDelegateImpl.java:60)
at com.aoc.judiciary.framework.ActionClasses.Action1.test1(Action1.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1912)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)
>>>>>>>>>>>>>>>>>>>>>>>>>>

any ideas greatly appreciated..
thanks
Jay
[ May 23, 2007: Message edited by: jay roy ]
hi guys

I am doing a hibernate excercise. I am not sure what i am doing wrong. This is what i have in my DAO

++++++++++++++++++++++++
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction trans = session.beginTransaction();
try {
SQLQuery sqlQuery = session.createSQLQuery("SELECT * from dbad.rst_item;");
List getSize = sqlQuery.list();
System.out.println("Size "+getSize);
trans.commit();

System.out.println("----------- Close the session------------- ");

session.close();
}
catch (Exception exp)
{

System.out.println("Rollback the session");
exp.printStackTrace();
// trans.rollback();
}

++++++++++++++++

This is my hibernate.cgf.xml

<session-factory>

<!-- Database connection settings -->
<property name="connection.datasource">jdbc/dwpastoreds</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.DB2390Dialect</property>
<property name="current_session_context_class">thread</property>

<mapping resource="spResourceMapping/TestVO.hbm.xml"/>

</session-factory>

+++++++++++++++++++++++++++++++++++++++++++

and this is my TestVO.hbm.xml

<hibernate-mapping>

<class name="com.aoc.judiciary.framework.ValueObjects.TestVO" table="RST_ITEM">


<id name="userId" column="1">
<generator class="native"/>
</id>
<property name="name" column="2"/>
<property name="city" column="3"/>

<property name="ssn" column="4"/>
<property name="dob" column="5"/>


<property name="extradbmappingfield1" column="6"/>
<property name="extradbmappingfield2" column="8"/>
<property name="extradbmappingfield3" column="9"/>
<property name="extradbmappingfield4" column="10"/>
<property name="extradbmappingfield5" column="13"/>
<property name="extradbmappingfield6" column="14"/>
<property name="extradbmappingfield7" column="15"/>
<property name="extradbmappingfield8" column="16"/>

</class>




</hibernate-mapping>

and i get this exception

>>>>>>>>>>>>>>>>>>>>>>>>>>
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:231)
at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1677)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at com.aoc.judiciary.framework.daoImpl.TestDaoImpl.insertInfo(TestDaoImpl.java:83)
at com.aoc.judiciary.framework.ejb.BeantestingBean.saveInfo(BeantestingBean.java:64)
at com.aoc.judiciary.framework.ejb.EJSLocalStatelessBeantesting_f63227a0.saveInfo(EJSLocalStatelessBeantesting_f63227a0.java:29)
at com.aoc.judiciary.framework.delegateImpl.LocalTestDelegateImpl.saveInfo(LocalTestDelegateImpl.java:60)
at com.aoc.judiciary.framework.ActionClasses.Action1.test1(Action1.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1912)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)
>>>>>>>>>>>>>>>>>>>>>>>>>>