RE: Simple Query using OJB

2007-01-05 Thread Xu, Jie (MED US)


It happens just sometimes (not always) that connection takes much longer
to process and the connection is in use for longer than 16 seconds. The
query looks like

Select A0.xxx  From WCPUSES where xxx = n


The findByOK is,
public ValueObject findByPK(String primaryKey)
throws DataAccessException {
  
PersistenceBroker broker = null;
WcpusesVO theVO = null;
   
try {
broker =
ServiceLocator.getInstance().findBroker();
theVO = new WcpusesVO();
theVO.setSessionNo(new Integer(primaryKey));
   
Query query = new QueryByCriteria(theVO);
theVO = (WcpusesVO)
broker.getObjectByQuery(query);
} catch (ServiceLocatorException e) {
Ms4Logger.log.error("ServiceLocatorException
thrown in WcpusesDAO.findByPK(): " + e.toString());
throw new
DataAccessException("ServiceLocatorException thrown in
WcpusesDAO.findByPK(): " + e.toString(),e);
} finally {
if (broker != null) {
broker.close();
}
}
   
return theVO;
}

Here is the data mapping












  







"Jay" Jie Xu
Siemens MED

-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 04, 2007 9:14 PM
To: OJB Users List
Subject: Re: Simple Query using OJB

Hi Jay,

Xu, Jie (MED US) wrote:
> Hello,
>
>
> We are using OJB in our Web application and we turn on the trace to
> monitor the DataSource connections. We find that when we are running a
> simple query through OJB, some time the connection will be in use for
> quite long time (say 16 seconds). Any insight on this?
>

Could you please post the query and the mapping of the queried object?
Do you lookup a PB instance, perform the query and close the used PB
instance immediately after use?

regards,
Armin

>
> Here is the trace
>
>
>
>
> MCWrapper id 89846770  Managed connection
> [EMAIL PROTECTED]
> State:STATE_TRAN_WRAPPER_INUSE Thread Id: 14f5fdea Thread Name:
> Servlet.Engine.Transports : 685 Handle count 0
>  Start time inuse Thu Jan 04 08:07:42 CST 2007 Time inuse 16
> (seconds)
>  Last allocation time Thu Jan 04 08:07:42 CST 2007
>getConnection stack trace information:
>   t java.lang.Throwable.(Throwable.java:179)
>  at
>
com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.j
> ava:435)
>  at
>
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSourc
> e.java:235)
>  at
>
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSourc
> e.java:205)
>  at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConne
> ctionFromDataSource(Unknown Source)
>  at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo
> nnection(Unknown Source)
>  at
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Un
> known Source)
>  at
>
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
> Unknown Source)
>  at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
> Source)
>  at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
> Source)
>  at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown
Source)
>  at
>
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknow
> n Source)
>  at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
> Unknown Source)
>  at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Un
> known Source)
>  at
>
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknow
> n Source)
>  at
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(
> Unknown Source)
>  at
>
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(
> Unknown Source)
>  at com.siemens.apps.wcbin.dao.WcpusesDAO.findByPK(WcpusesDAO.java:50)
>  at
> com.siemens.apps.filters.SessionFilter.doFilter(SessionFilter.java:69)
>  at
>
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInst
> anceWrapper.java:130)
>  at
>
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
> ain.java:54)
>  at
>
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppD

Simple Query using OJB

2007-01-04 Thread Xu, Jie (MED US)

Hello,

We are using OJB in our Web application and we turn on the trace to
monitor the DataSource connections. We find that when we are running a
simple query through OJB, some time the connection will be in use for
quite long time (say 16 seconds). Any insight on this?

Here is the trace


MCWrapper id 89846770  Managed connection
[EMAIL PROTECTED]
State:STATE_TRAN_WRAPPER_INUSE Thread Id: 14f5fdea Thread Name:
Servlet.Engine.Transports : 685 Handle count 0
 Start time inuse Thu Jan 04 08:07:42 CST 2007 Time inuse 16
(seconds)
 Last allocation time Thu Jan 04 08:07:42 CST 2007
   getConnection stack trace information:
  t java.lang.Throwable.(Throwable.java:179)
 at
com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.j
ava:435)
 at
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSourc
e.java:235)
 at
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSourc
e.java:205)
 at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConne
ctionFromDataSource(Unknown Source)
 at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo
nnection(Unknown Source)
 at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Un
known Source)
 at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
Unknown Source)
 at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
 at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
Source)
 at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source)
 at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknow
n Source)
 at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
Unknown Source)
 at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Un
known Source)
 at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknow
n Source)
 at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(
Unknown Source)
 at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(
Unknown Source)
 at com.siemens.apps.wcbin.dao.WcpusesDAO.findByPK(WcpusesDAO.java:50)
 at
com.siemens.apps.filters.SessionFilter.doFilter(SessionFilter.java:69)
 at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInst
anceWrapper.java:130)
 at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
ain.java:54)
 at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:807)
 at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:269)
 at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:156)
 at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:1
21)
 at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInv
oker.java:229)
 at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocati
on(CachedInvocation.java:66)
 at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invo
ke(CacheableInvocationContext.java:106)
 at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(Servle
tRequestProcessor.java:126)
 at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSELis
tener.java:317)
 at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection
.java:56)
 at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:
576)
 at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:376)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:915)



"Jay" Jie Xu
Siemens MED




This message and any included attachments are from Siemens Medical Solutions
and are intended only for the addressee(s).
The information contained herein may include trade secrets or privileged or
otherwise confidential information. Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful. If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to [EMAIL PROTECTED]

Thank you

Variable Length Field with DB2?400

2006-11-28 Thread Xu, Jie (MED US)

Folks,

We use OJB as the data access bridge to access DB2/400 data in our Web
application. In some of our DB2/400 tables, we define the variable
length field, such as VARCHAR(4096) which allow up to 4096 characters.
We use the following field definition in OJB,



But, when try to insert record, "Data truncated" error received with the
String length only about 160. If the String length is short, we do not
have the problem. Any suggestion or advices?

Thank you very much

"Jay" Jie Xu




This message and any included attachments are from Siemens Medical Solutions
and are intended only for the addressee(s).
The information contained herein may include trade secrets or privileged or
otherwise confidential information. Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful. If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to [EMAIL PROTECTED]

Thank you

RE: FW: Variable Length Field with DB2?400

2006-11-28 Thread Xu, Jie (MED US)
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
Source)
at
com.siemens.med.hs.ms4.oc_file.dao.OcpmaltDAO.insert(OcpmaltDAO.java:49)
at
com.siemens.med.hs.ms4.oc_file.dao.DrugAlertsDAO.insertAlert(DrugAlertsD
AO.java:151)
at
com.siemens.med.hs.ms4.orders.OrderAlertProcess.writeAlertFiles(OrderAle
rtProcess.java:2208)
at
com.siemens.med.hs.ms4.portal.actions.WellAction.sendOrders(WellAction.j
ava:2331)
at
com.siemens.med.hs.ms4.portal.actions.WellAction.execute(WellAction.java
:1061)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.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:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictSe
rvletInstance.java:110)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLi
fecycleServlet.java:174)
at
com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycle
Servlet.java:313)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLif
ecycleServlet.java:116)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.
java:283)
at
com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(Vali
dServletReferenceState.java:42)
at
com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Servle
tInstanceReference.java:40)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
ain.java:76)
at
com.siemens.med.hs.ms4.filters.SessionFilter.doFilter(SessionFilter.java
:291)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInst
anceWrapper.java:132)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterCh
ain.java:71)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispa
tch(WebAppRequestDispatcher.java:974)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRe
questDispatcher.java:564)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppReq
uestDispatcher.java:200)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:1
19)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInv
oker.java:276)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocati
on(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invo
ke(CacheableInvocationContext.java:116)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(Servle
tRequestProcessor.java:186)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSELis
tener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection
.java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:
618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)


"Jay" Jie Xu
Siemens MED

Office: 801-539-4642
Mobile: 801-856-4402
Fax: 801-533-8004


-Original Message-
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Monday, November 27, 2006 6:11 PM
To: OJB Users List
Subject: Re: FW: Variable Length Field with DB2?400

Hi Jay,

Xu, Jie (MED US) wrote:
> Folks,
>
>
> We use OJB as the data access bridge to access DB2/400 data in our Web
> application. In some of our DB2/400 tables, we define the variable
> length field, such as VARCHAR(4096) which allow up to 4096 characters.
> We use the following field definition in OJB,
>
>
> 
>
> id="7"
>
>
> name="screenMsg"
>
>
> column="ALMSGT"
>
>
> jdbc-type="VARCHAR"
>
> length="4096"
>
> />
>
> But, when try to insert record, "Data truncated" error received with
the
> String length only about 160. If the String length is short, we do not
> have the problem. Any suggestion or advices?
>

OJB doesn't truncate any String objects. I think this is a jdbc-driver
or DB table issue. Did you checked the DB table, is the column really
VARCHAR(4096)? Could you post stack trace?

regards,
Armin


>
> Thank

FW: Variable Length Field with DB2?400

2006-11-27 Thread Xu, Jie (MED US)



Folks,

We use OJB as the data access bridge to access DB2/400 data in our Web
application. In some of our DB2/400 tables, we define the variable
length field, such as VARCHAR(4096) which allow up to 4096 characters.
We use the following field definition in OJB,



But, when try to insert record, "Data truncated" error received with the
String length only about 160. If the String length is short, we do not
have the problem. Any suggestion or advices?

Thank you very much

"Jay" Jie Xu




This message and any included attachments are from Siemens Medical Solutions
and are intended only for the addressee(s).
The information contained herein may include trade secrets or privileged or
otherwise confidential information. Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful. If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to [EMAIL PROTECTED]

Thank you

Data Type Cast When Perform the Join

2004-01-08 Thread Xu Jie

Hello,

I have to do a simple one-to-one mapping with OJB. The key to perform the
join from parent object is different from the child key. For example, in
parent object the key is userID with type of CHAR, but the child object key
childUserID is a type of BIGINT. Will OJB do any data cast in this
situation?

Thanks.
 



---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED] 

Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



FW: How to map CHAR in Java object?

2003-10-29 Thread Xu Jie

Error is when updating,

 [SQL7008] WCPUSES in WCBINPIBIT not valid for operation.
[10/29/03 16:07:41:576 PST] 346112f2 SystemOut O [SQL7008] WCPUSES in
WCBINPIBIT not valid for operation.

>  -Original Message-
> From:         Xu Jie  
> Sent: Wednesday, October 29, 2003 3:58 PM
> To:   OJB Users List
> Subject:  How to map CHAR in Java object?
> 
> 
> I am quite new to this OJB project. I have database table which contains
> CHAR field. When I map VARCHAR field to String in my Value Object,
> everything seems fine. But when mapping CHAR to String in Value Object, I
> can read from DB OK, but failed when trying to update. Any help?
> 
> Thanks

---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to map CHAR in Java object?

2003-10-29 Thread Xu Jie


I am quite new to this OJB project. I have database table which contains
CHAR field. When I map VARCHAR field to String in my Value Object,
everything seems fine. But when mapping CHAR to String in Value Object, I
can read from DB OK, but failed when trying to update. Any help?

Thanks

---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



User/Password for JDBC Connection

2003-09-30 Thread Xu Jie

All,

I have a question about using OJB with specific user and password. The
question is two fold,
1) Can we encrypt the user and password in repository.xml file? Exposing
user and password certainly has some security concerns.
2) If I create JDBC connections by providing user and password at run time,
these connections can not be reused. In another word, it has to create a new
JDBC connection every time which is expensive. Am I right?

Thanks.

Jay



---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Question on Tutorial1

2003-07-07 Thread Xu Jie

All,

I am new to this ObJectRelationalBridge (OJB) project. So I used Tutorial1
to teach myself something about OJB. It works fine according to the online
doc in my DOS console. Next I did is to move only needed files (jar, xml
...) to my development environment. After some work, the Tutorial starts
working in my development environment with one interesting exception. I have
to use option 1 first to enter new record. If I use option 0 to view list
first, I will get following message when I try to enter new one,
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was
called, do rollback on current connection [EMAIL PROTECTED]
ConnectionManager is NOT in transaction
But if I do option 1 first, I do not see any problem at all.
Thank you for your help,  




---
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]