Container finder methods
If I define a container finder method, and try to fetch the
records by issuing a call to that finder method, I get the last
record repeated the number of times the number of records are in total.
I do not know whether it is a bug in the server or there is some other solution to it. If i install sp4, then it works for
somedays but trips soon after. I feel there is something wrong
about the way the container manages caching of db records.
I am looking forward for a quick answer.
Piyush ([email protected])
This was a bug introduced in SP3. Grab the latest service pack and
recompile your beans with the service pack in front of your classpath.
-- Rob
Piyush Bhattacharya wrote:
>
If I define a container finder method, and try to fetch the
records by issuing a call to that finder method, I get the last
record repeated the number of times the number of records are in total.
I do not know whether it is a bug in the server or there is some other solution to it. If i install sp4, then it works for
somedays but trips soon after. I feel there is something wrong
about the way the container manages caching of db records.
I am looking forward for a quick answer.
Piyush ([email protected])
Similar Messages
-
How to add a finder method in the container manager Bean in the weblogic6.1
in the environment jbuilder6 andweblogic6.1,use container manager entity Bean,it can automatic generate the findAll() method,I want to add a new method to find an element in the home interface,such as findByName(),name is a element of a table of the database.in the weblogic-cmp-rdbms-jar.xml,this is part of the fiile:
<finder>
<finder-name>findAll</finder-name>
<finder-query><![CDATA[ (= 1 1) ]]></finder-query>
</finder>
<finder>
<finder-name>findByName</finder-name>
<finder-param>java.lang.String</finder-param>
<finder-query><![CDATA[ (=name $name) ]]></finder-query>
</finder>
It can successfully compile the findAll(),but it is wrong when compile the findByName(),as follows
"www.ejbgrpx": Method Name: findByName
"www.ejbgrpx": Invalid specifications for a WebLogic RDBMS CMP EJB.
"www.ejbgrpx": ERROR: Error from ejbc: weblogic.ejb20.cmp11.rdbms.finders.IllegalExpressionException:
"www.ejbgrpx": While trying to process Finder
"www.ejbgrpx": Parameter Types: (java.lang.String)
"www.ejbgrpx": WebLogic Query: (= name $name)
"www.ejbgrpx": Finder Expressions: ()
"www.ejbgrpx": Could not parse WLQL expression: (= name $name) null
"www.ejbgrpx": ERROR: ejbc found errors
thank youThe finder methods that you are referring to are only simple finder methods. If you would like to add specialized finder methods, you can make your entity bean with bean managed persistence and not container managed. If you are using EJB 2.0, your entity bean with container managed persistence can use EJB QL for finder methods. You can search for this topic and/or download the EJB 2.0 specifications
Hope this helps -
Finder method in container-managed entity bean
Finder method of a container entity bean is taking the primary key class object of another entity bean. How to map this in the xml descriptor file weblogic-cmp-rdbms.xml for this type of beans.
I am trying to deploy the jasmine computer store of Mastering EJB by EdRoman.
I couldn't write the deployment file weblogic-cmp-rdbms.xml for Order Entity bean which uses CustomerPK as an argument in its finder method.
Please tell me how to write this. I am trying on weblogic 5.1
Thanx in advance
Srivatsahello,
in container managed persistence, you specify on your xml file the name of your table. so the primary key you want to use have to be a foreign key in your table. otherwise i don't think that you can use a container managed persistence.
Najib. -
Not able to reload the data from DB using finder methods
Hi all,
<p>
I am facing a weird problem while using finder methods.
I am using weblogic 8.1 SP3 and entity beans are CMP with DB concurrency.DB is oracle
</p>
<h4>Problem Description</h4>
<p>
I am having one session bean which internally interacts with my entity beans,
Now say my transaction is getting initiated in one of the session bean and I use some finder in it.
</p>
<p>
To make the problem more clear lets say my entity bean is loanBean with loanId as primary key.
Now say method A of session bean initiates the transaction and I use something like
<br>
LoanLocal loanLocal =loanLocalHome.findByLoanId(loanId);
<br>
<b>Note that I am not using findByPrimaryKey method</b>
<br>
now this method A calls some other method B on some session bean which is having Required as its transaction attribute.
<br>
But before the call of B some other thread or background process updates the DB for this loanId and commits,
<br>
now when I fire the same finder in method B I am still getting the old data, ie I am not getting the data which has been modified in DB and committed by some other thread, I still get the old data and when I tried to generate the SQL queries which weblogic is firing, I see
it fires the SQL for every finder other that findByPrimaryKey.
<br>
<b>
Now my problem is I am getting the old data only and I need the new updated data of DB. isolation-level of DB and beans is READCOMMITTED.
Note:: I cant use new transaction to read the data.
</b>
<br>
And I couldn't understand that when weblogic is firing query for every finder then why it should not refresh the data in its cache. Is there any way to disable this kind of caching and say that everytime when i use finder just go to DB and get me the last committed data.
</p>
<br>
Any help in this regard would be very helpful to me.
<br>
Thanks and Regards
<br>
Manish Garg.
</p>Hi,
In my understanding, cache is not involved in this scenario. As you
observed, the container fires sql every time when you invoke this finder.
So, it should just give the result that it got from the DB. Is there a
possibility that the DB is using repeatable_read or serializable for
isolation level?
You can debug further by doing couple of things -
1. Instrument the code in the generated RDBMS java file for the entity bean
(if you use -keepgenerated option for weblogic.ejbc, u can get the source of
this file). This class will have the implementation for ejbFindByLoanId. You
can just print the result set data after the query is fired.
2. Try the same scenario without the ejb container. Like, write a jsp which
will start a user tx and fire the query twice such that there is an update
between the two queries. Note that, you need to use a TxDataSource to get
the JDBC connection so that it will be tx aware.
--Sathish
<Manish Garg> wrote in message news:[email protected]...
Hi all,
<p>
I am facing a weird problem while using finder methods.
I am using weblogic 8.1 SP3 and entity beans are CMP with DB
concurrency.DB is oracle
</p>
<h4>Problem Description</h4>
<p>
I am having one session bean which internally interacts with my entity
beans,
Now say my transaction is getting initiated in one of the session bean and
I use some finder in it.
</p>
<p>
To make the problem more clear lets say my entity bean is loanBean with
loanId as primary key.
Now say method A of session bean initiates the transaction and I use
something like
<br>
LoanLocal loanLocal =loanLocalHome.findByLoanId(loanId);
<br>
<b>Note that I am not using findByPrimaryKey method</b>
<br>
now this method A calls some other method B on some session bean which is
having Required as its transaction attribute.
<br>
But before the call of B some other thread or background process updates
the DB for this loanId and commits,
<br>
now when I fire the same finder in method B I am still getting the old
data, ie I am not getting the data which has been modified in DB and
committed by some other thread, I still get the old data and when I tried
to generate the SQL queries which weblogic is firing, I see
it fires the SQL for every finder other that findByPrimaryKey.
<br>
<b>
Now my problem is I am getting the old data only and I need the new
updated data of DB. isolation-level of DB and beans is READCOMMITTED.
Note:: I cant use new transaction to read the data.
</b>
<br>
And I couldn't understand that when weblogic is firing query for every
finder then why it should not refresh the data in its cache. Is there any
way to disable this kind of caching and say that everytime when i use
finder just go to DB and get me the last committed data.
</p>
<br>
Any help in this regard would be very helpful to me.
<br>
Thanks and Regards
<br>
Manish Garg.
</p> -
CMP Entity Bean with ejb-ql finder methods and INFORMIX database
Hi,
I have some CMP Entity Beans with finder methods defined in ejb-ql. In my ejb-jar, within <entity> definitions I have something like:
<entity>
<abstract-schema-name>BeanName</abstract-schema-name>
<cmp-field><field-name>fieldOne</field-name></cmp-field>
<cmp-field><field-name>fieldTwo</field-name></cmp-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
<ejb-ql>SELECT OBJECT(o) FROM BeanName o</ejb-ql>
</query>
<entity>
And in persistent.xml:
<db-properties>
<data-source-name>datasource_name</data-source-name>
</db-properties>
<entity-bean>
<ejb-name>BeanName</ejb-name>
<table-name>table_name</table-name>
<field-map key-type="NoKey">
<field-name>fieldOne</field-name>
<column><column-name>column_one</column-name></column>
</field-map>
<field-map key-type="NoKey">
<field-name>fieldTwo</field-name>
<column><column-name>column_two</column-name></column>
</field-map>
<finder-descriptor>
<method-name>findAll</method-name>
<method-params/>
</finder-descriptor>
Once deployed, on server side, I can found a java source file (with corresponding compiled class file) in path:
j2ee/cluster/server0/apps/companyName/MyEARApp/EJBContainer/temp/temp38837373733/route/to/package/
with names:
BeanName0_0pm.java
BeanName0_0PM.class
and the generated java file contains this code:
public java.util.Enumeration ejbFindAll() throws javax.ejb.FinderException, javax.ejb.EJBException {
TransactionContext tc = pm.getTransactionContext();
Connection conn = null;
PreparedStatement pSt = null;
ResultSet ejb_rs = null;
int status = javax.transaction.xa.XAResource.TMSUCCESS;
try {
conn = pm.getConnectionForFindMethod();
pSt = conn.prepareStatement("SELECT \"O\".\"COLUMN_ONE\",\"O\".\"COLUMN_TWO\", FROM \"TABLE_NAME\" \"O\"");
ejb_rs = pSt.executeQuery();
I'm trying to call this method but it throws a SQLException when preparing the statement.
It seems that Informix does not like this SQL syntax because of upper case names, doble quotes on table alias, or something else.
When editing persistent.xml in netweaver, I can define the element <datasource-vendor> as ORACLE, SAPDB, MS_SQL_SERVER, DB2_UDB_AS400 or DB2_UDB_OS390 but INFORMIX is not an accepted value.
Is there any way to define how this SQL query is build?
Thanks in advance.The return type of the finder method defined in the remote home interface is either the entity bean's remote interface or a collection of objects implementing the entity bean's remote interface. The return type of the finder method defined in the local home interface is either the entity bean's local interface or a collection of objects implementing the entity bean's local interface
-
Collection returned by finder methods
Collection returned by finder methods are serialized to the clients or referenced?
When a client access a EJB and invoke each finder method, the result back to the client is a collection (for every finder methods unless the findByPrimaryKey). This collection is serialized to the client o is accessed by the client from the container remotely?I guess it is serialized. The EJB works on the rmi logic.
-
We do not implement finder method in Bean class for CMP. As such, where do we implement finder methods such as findInRange() method? How does the container implement my custom "find" methods.
ThanksUsing CMP 2.x, your custom finder and select methods are implemented by the container based on the EJB QL query you provide in the ejb-jar.xml. In CMP 1.1, there was no portable way to express the semantics of the query, so most vendors had a vendor-specific syntax for describing the query.
See chapter 27 of the J2EE 1.4 Tutorial for some examples of using EJB QL :
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
--ken
Kenneth Saks
J2EE SDK Team
SUN Microsystems -
Binary Data Type in finder methods for CMP beans
How to write an equivalent ejb-ql query in ejb-jar.xml for a finder method accepting
a byte array as a parameter. The finder method is for a cmp-field mapped to a
database field with binary data typeUsing CMP 2.x, your custom finder and select methods are implemented by the container based on the EJB QL query you provide in the ejb-jar.xml. In CMP 1.1, there was no portable way to express the semantics of the query, so most vendors had a vendor-specific syntax for describing the query.
See chapter 27 of the J2EE 1.4 Tutorial for some examples of using EJB QL :
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
--ken
Kenneth Saks
J2EE SDK Team
SUN Microsystems -
Finder-method in orion-ejb-jar.xml
Hi,
Is there a way to let jdeveloper 9.0.3 preview to automatically generate finder-method descriptors for us? When I was developing a cmp-based entity bean, although I defined the ejb-ql in ejb-jar.xml, JDeveloper still just generated the first orion-ejb-jar.xml shown below. In the first orion-ejb-jar.xml, there is no definition for any finder-method. I have to manually add my own definition to it, which is shown in the second orion-ejb-jar.xml. I know that the oc4j container will generate the finder-method after deployment, but in some situation it generated incorrect finder-method descriptors. One of such situation is the between query like "between ?1 and ?2". Anyway, if JDeveloper can generate the finder-method during development, then we can know whether the descriptor is correct or not before deployment, and we can make modifications before deploying it to oc4j server.
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" " " target="_new">http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd"> <orion-ejb-jar>
<enterprise-beans>
<entity-deployment name="BooksBean" data-source="jdbc/bookDS" table="BOOKS">
<primkey-mapping>
<cmp-field-mapping>
<fields>
<cmp-field-mapping name="isbn" persistence-name="ISBN" persistence-type="NUMBER(10)"/>
</fields>
</cmp-field-mapping>
</primkey-mapping>
<cmp-field-mapping name="isbn" persistence-name="ISBN" persistence-type="NUMBER(10)"/>
<cmp-field-mapping name="title" persistence-name="TITLE" persistence-type="VARCHAR2(50)"/>
<cmp-field-mapping name="author" persistence-name="AUTHOR" persistence-type="VARCHAR2(50)"/>
<cmp-field-mapping name="price" persistence-name="PRICE" persistence-type="NUMBER(6,2)"/>
</entity-deployment>
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping name="<default-ejb-caller-role>" impliesAll="true"/>
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" " " target="_new">http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd"> <orion-ejb-jar>
<enterprise-beans>
<entity-deployment name="BooksBean" data-source="jdbc/bookDS" table="BOOKS">
<primkey-mapping>
<cmp-field-mapping name="isbn" persistence-name="ISBN" persistence-type="NUMBER(10)"/>
</primkey-mapping>
<cmp-field-mapping name="isbn" persistence-name="ISBN" persistence-type="NUMBER(10)"/>
<cmp-field-mapping name="title" persistence-name="TITLE" persistence-type="VARCHAR2(50)"/>
<cmp-field-mapping name="author" persistence-name="AUTHOR" persistence-type="VARCHAR2(50)"/>
<cmp-field-mapping name="price" persistence-name="PRICE" persistence-type="NUMBER(6,2)"/>
<finder-method query="select * from books where $author like $1">
<method>
<ejb-name>BooksBean</ejb-name>
<method-name>findByAuthor</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
</finder-method>
<finder-method query="select * from books where $title like $1">
<method>
<ejb-name>BooksBean</ejb-name>
<method-name>findByTitle</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
</finder-method>
<finder-method query="$price between $1 and $2">
<method>
<ejb-name>BooksBean</ejb-name>
<method-name>findByPriceRange</method-name>
<method-params>
<method-param>double</method-param>
<method-param>double</method-param>
</method-params>
</method>
</finder-method>
</entity-deployment>
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping impliesAll="true" name="<default-ejb-caller-role>"/>
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
Any one has any idea?
Thanks,
JingzhiJingzhi -- If you define the correct EJB-QL you should get the correct SQL generated for the finder. If that's not happening can you verify it against the OC4J v903 production release and see if it is still happening. I don't know if this helps with the JDeveloper problem specifically but if you don't need to create your own finders then that I hope should help.
Thanks -- Jeff -
FAILED TO FIND METHOD FOR HASH ...
here is the trace of the pb... I hope that someone can help me.
java.lang.IllegalStateException: Failed to find method for hash:5806955373774276652
at org.jboss.invocation.MarshalledInvocation.getMethod(MarshalledInvocation.java:367)
at org.jboss.ejb.Container.invoke(Container.java:742)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:53)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
at $Proxy0.create(Unknown Source)
at server.client.ClientCompteur.main(ClientCompteur.java:46)You must be asking the wrong forum.
This is a forum dedicated to the Sun Java Studio Creator product.
Try here: http://developers.sun.com/forums/
-Alexis -
Finder Methods other than by Primary key
How should the Finder methods other than by Primary
key in Container MB be implemented? In Bean class?
I did some search in archives to no avail.
Thanks!!
SriramI think it might be different on different app servers, at least until EJB 2.0 is implemented everywhere. I found a bit of info on the matter:
http://www.jboss.org/documentation/HTML/ch06s07.html -
Finder Methods - Does xmlbeans support this?
Finder Methods - Does xmlbeans support this?
Hi,
Q1 - Is there currently a mechanism via generated xmlbeans java classes to
find specific data required (from within the java generated methods
provided). For example assuming in the following xml (see below) if one has
already loaded the <main-item> via xmlbean generated java classes, but then
wishes to find the appropriate configs/config within this section of the xml
(i.e. the main-item entry "config" is a reference to one of the "config"
items under "configs") , does XMLBeans currently support this? That is, it
would be nice to have finder methods on the generated java classes so once
you have a <configs> java instance you can issue a finder method for a
<config> item and pass the <config-name> in. For example:
What is available: MainXML.getConfigs().getConfig(23) -> i.e. put in
index,
However what about: MainXML.getConfigs().findConfig ("mainConfig");
Q2 - If there is no support for this within the generated java classes what
is recommended? Via xpath? Have to write your own short java finder classes
which iterate through until the item is found?
ATTACHMENT - XML REFERED TO
============================
< MainXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xxx.xsd">
<configs>
<config>
<config-name>mainConfig</config-name>
<report_width>1</report_width>
</config>
<config>
<config-name>testConfig</config-name>
<report_width>0</report_width>
</config>
</configs>
<main-config>
<main-item>
<itemName>TestItem</itemName>
<config>mainConfig</config>
</main-item>
</main-config>
</sns_config>
Cheers
Gregthanks Steve
"Steve Traut" <[email protected]> wrote in message
news:[email protected]...
Hello Greg,
To my knowledge, the reference-specific kind of function you're asking for
isn't supported. But if you're writing code on WebLogic Platform 8.1, you
can use XPath/XQuery to accomplish this. Incidentally, your XML belowopens
with MainXML and closes with sns_config, but I'll assume it's MainXML.
To retrieve a main-config/main-item/config element when you know the
config-name element's value, you could use the following expression (where
the mainXml variable is a MainXMLDocument instance):
String queryExpression = "$this/MainXML/configs/config[config-name=
'mainConfig']";
ConfigType[] configs =
(ConfigType[])mainXml.selectPath(queryExpression);
The configs array would contain one item in this case. The second linewould
throw a class cast exception if no results were returned.
Note that XPath predicates aren't supported in XMLBeans outside thecontext
of WebLogic, but simple path expressions are.
Steve
"greg" <[email protected]> wrote in message news:1074728633.92236@ns1...
Finder Methods - Does xmlbeans support this?
Hi,
Q1 - Is there currently a mechanism via generated xmlbeans java classes
to
find specific data required (from within the java generated methods
provided). For example assuming in the following xml (see below) if onehas
already loaded the <main-item> via xmlbean generated java classes, butthen
wishes to find the appropriate configs/config within this section of thexml
(i.e. the main-item entry "config" is a reference to one of the
"config"
items under "configs") , does XMLBeans currently support this? That is,it
would be nice to have finder methods on the generated java classes so
once
you have a <configs> java instance you can issue a finder method for a
<config> item and pass the <config-name> in. For example:
What is available: MainXML.getConfigs().getConfig(23) -> i.e. putin
index,
However what about: MainXML.getConfigs().findConfig ("mainConfig");
Q2 - If there is no support for this within the generated java classeswhat
is recommended? Via xpath? Have to write your own short java finderclasses
which iterate through until the item is found?
ATTACHMENT - XML REFERED TO
============================
< MainXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xxx.xsd">
<configs>
<config>
<config-name>mainConfig</config-name>
<report_width>1</report_width>
</config>
<config>
<config-name>testConfig</config-name>
<report_width>0</report_width>
</config>
</configs>
<main-config>
<main-item>
<itemName>TestItem</itemName>
<config>mainConfig</config>
</main-item>
</main-config>
</sns_config>
Cheers
Greg -
Deployment problem with finder method
I have a problem deploying an application that was working prior to my adding a finder method to one of the entity beans. Here is the Descriptor from the EJB Module that i created (which appears to be ok):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>RFXModule</display-name>
<enterprise-beans>
<session>
<display-name>RFXManager</display-name>
<ejb-name>RFXManager</ejb-name>
<home>au.com.alphawest.trader.rfx.business.management.RFXManagerHome</home>
<remote>au.com.alphawest.trader.rfx.business.management.RFXManagerRemote</remote>
<ejb-class>au.com.alphawest.trader.rfx.business.management.RFXManagerBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/rfx/RFXDocument</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXDocumentLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXDocumentLocal</local>
<ejb-link>RFXDocument</ejb-link>
</ejb-local-ref>
</session>
<entity>
<display-name>RFXAttachment</display-name>
<ejb-name>RFXAttachment</ejb-name>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXAttachmentLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXAttachmentLocal</local>
<ejb-class>au.com.alphawest.trader.rfx.business.data.RFXDocumentAttachment</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>RFXAttachment</abstract-schema-name>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<cmp-field>
<field-name>type</field-name>
</cmp-field>
<cmp-field>
<field-name>attachmentContents</field-name>
</cmp-field>
<primkey-field>name</primkey-field>
</entity>
<entity>
<display-name>RFXDocument</display-name>
<ejb-name>RFXDocument</ejb-name>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXDocumentLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXDocumentLocal</local>
<ejb-class>au.com.alphawest.trader.rfx.business.data.RFXDocumentBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>au.com.alphawest.trader.rfx.business.data.RFXDocumentPK</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>RFXDocument</abstract-schema-name>
<cmp-field>
<field-name>documentGUID</field-name>
</cmp-field>
<cmp-field>
<field-name>creationDate</field-name>
</cmp-field>
<cmp-field>
<field-name>creatorGUID</field-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
</cmp-field>
<cmp-field>
<field-name>dueDate</field-name>
</cmp-field>
<cmp-field>
<field-name>emailAddress</field-name>
</cmp-field>
<cmp-field>
<field-name>faxNo</field-name>
</cmp-field>
<cmp-field>
<field-name>locked</field-name>
</cmp-field>
<cmp-field>
<field-name>notes</field-name>
</cmp-field>
<cmp-field>
<field-name>organisationName</field-name>
</cmp-field>
<cmp-field>
<field-name>ownerGUID</field-name>
</cmp-field>
<cmp-field>
<field-name>requestId</field-name>
</cmp-field>
<cmp-field>
<field-name>subject</field-name>
</cmp-field>
<cmp-field>
<field-name>telephoneNo</field-name>
</cmp-field>
<cmp-field>
<field-name>unitGUID</field-name>
</cmp-field>
<cmp-field>
<field-name>buyer</field-name>
</cmp-field>
<cmp-field>
<field-name>organisationGUID</field-name>
</cmp-field>
<cmp-field>
<field-name>sourceId</field-name>
</cmp-field>
<ejb-local-ref>
<ejb-ref-name>ejb/rfx/RFXDocumentAttachment</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXAttachmentLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXAttachmentLocal</local>
<ejb-link>RFXAttachment</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<description>A line item attached to this document</description>
<ejb-ref-name>ejb/rfx/RFXLineItem</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXLineItemLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXLineItemLocal</local>
<ejb-link>RFXLineItemBean</ejb-link>
</ejb-local-ref>
<query>
<description>Find the rfx documents related to the given supplier through it's line items</description>
<query-method>
<method-name>findBySupplierId</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(d) FROM RFXDocument AS d, IN(d.lineItems) l WHERE l.supplierGuid = 'DummySupplierGuid'</ejb-ql>
</query>
</entity>
<entity>
<display-name>RFXLineItem</display-name>
<ejb-name>RFXLineItem</ejb-name>
<local-home>au.com.alphawest.trader.rfx.business.data.RFXLineItemLocalHome</local-home>
<local>au.com.alphawest.trader.rfx.business.data.RFXLineItemLocal</local>
<ejb-class>au.com.alphawest.trader.rfx.business.data.RFXLineItemBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.math.BigDecimal</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>RFXLineItem</abstract-schema-name>
<cmp-field>
<field-name>itemId</field-name>
</cmp-field>
<cmp-field>
<field-name>rfxGuid</field-name>
</cmp-field>
<cmp-field>
<field-name>contractCode</field-name>
</cmp-field>
<cmp-field>
<field-name>supplierGuid</field-name>
</cmp-field>
<cmp-field>
<field-name>productCode</field-name>
</cmp-field>
<cmp-field>
<field-name>description</field-name>
</cmp-field>
<cmp-field>
<field-name>quantity</field-name>
</cmp-field>
<cmp-field>
<field-name>units</field-name>
</cmp-field>
<primkey-field>itemId</primkey-field>
</entity>
</enterprise-beans>
<relationships>
<ejb-relation>
<ejb-relation-name>RFXDocument-RFXAttachment</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>RFXDocument</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>RFXDocument</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>attachments</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>RFXAttachment</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>RFXAttachment</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
<ejb-relation>
<ejb-relation-name>RFXDocument-RFXLineItem</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>RFXDocument</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>RFXDocument</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>lineItems</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>RFXLineItem</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>RFXLineItem</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>
<assembly-descriptor>
<container-transaction>
<description>This value was set as a default by Sun ONE Studio.</description>
<method>
<ejb-name>RFXAttachment</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<description>This value was set as a default by Sun ONE Studio.</description>
<method>
<ejb-name>RFXDocument</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<description>This value was set as a default by Sun ONE Studio.</description>
<method>
<ejb-name>RFXLineItem</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<description>This value was set as a default by Sun ONE Studio.</description>
<method>
<ejb-name>RFXManager</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
I get the following error message when i try to run the EJB Module through the Sun One Verifier Tool:
Error: ** Error trying to process file: java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
at com.sun.enterprise.deployment.xml.EjbNode.parseQueries(EjbNode.java:700)
at com.sun.enterprise.deployment.xml.EjbNode.completeLoadingDescriptor(EjbNode.java:671)
at com.sun.enterprise.deployment.xml.EjbBundleNode.completeLoadingDescriptor(EjbBundleNode.java:524)
at com.iplanet.ias.deployment.EjbBundleXmlReader.load(EjbBundleXmlReader.java:249)
at com.iplanet.ias.deployment.EjbBundleXmlReader.loadStdAloneModule(EjbBundleXmlReader.java:162)
at com.sun.enterprise.tools.verifier.Verifier.openEjbJar(Verifier.java:2421)
at com.sun.enterprise.tools.verifier.Verifier.loadEjbJar(Verifier.java:1318)
at com.sun.enterprise.tools.verifier.Verifier.loadJar(Verifier.java:866)
at com.sun.enterprise.tools.verifier.gui.MainPanel.run(MainPanel.java:187)
at java.lang.Thread.run(Thread.java:536)
Look in file "RFXModule.jar_verified.xml" for detailed results on test assertions.
Any help would be greatly appreciated.
Mark HeskethLaunch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
The title of the Console window should be All Messages. If it isn't, select
SYSTEM LOG QUERIES ▹ All Messages
from the log list on the left. If you don't see that list, select
View ▹ Show Log List
from the menu bar at the top of the screen.Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
Please don't indiscriminately dump thousands of lines from the log into this discussion.
Please don't post screenshots of log messages—post the text.
Some private information, such as your name, may appear in the log. Anonymize before posting. -
The Oracle documents suggests that the following definition in the EJBHome is enough to create a finder method
public Enumeration findByWhere(String where) throws RemoteException, FinderException;
I get a java.lang.AbstractMethodError on the client when I try to call this - suggesting the the container is not implementing the method for me.
I see no place in the oracle descriptor to define these finder methods.
What is the deal with these ? How does one use CMP and Finder methods other than the standard "findByPrimaryKey(....)
thanks
nullHello,
Let say you don't want to uyse the defualt finder methods, then you can write your own like:
(in client servlet/JSP file etc..)
emps = home.findByLast_name(request.getParameter("searchText")); //find by last name
where:
step 1) go to EJB class editor (under your main EJB directory)
step 2) click on finder tab and click add, to add new finder methods
step 3) (you can click help now to get more info on this..anyways) findBy<CMB field>
would automatically check the "Managed by OC4j" check box, this means that you have matched a signature tag for finders (kind of like setXX and getXX if you are doing JavaBean...automatically done for you)
step 4) else you can make one that is not up like findWildCard(String wildCard):
i)by specifying the Method name to be: findWildCard
ii)parameter (String type: wildCard)
step 5) rebuild the EJB directory after you add this method
step 6) use it in any of you client servlet/JSP as you would with the defualt findAll() methods etc..
cheers,
-Long
[email protected] -
how many Finder method in Entity bean i can write ?
look below...
public Account findByPrimaryKey(AccountPK key) throws FinderException,
RemoteException;
public Enumeration findByOwnerName(String name) throws FinderException,
RemoteException;here 2 finder methods are there.......i am asking how much freedom i have ? can write as many as finder method i wish ?
say, findXXXX() ?my problem is on the signature of the find
method.
OK let me ask you some other way.
java DOC says
Each enterprise Bean has a home interface. The home
interface must extend the javax.ejb.EJBHome
interface, and define the enterprise Bean type
specific create and finder methods (session Beans do
not have finders).
look it says " finder methods "....right .
so i want to ask 2 question about this phrase . PLZ
do confirm me whether i am right or wrong.
fact 1. finder methods means you can write
any method name which starts with word find
and ONLY find
Example: findABCD( ) , findEFGH(),
findBLAHBLAH()...any thing starts with find[i]
are called finder methods...others are NOT.
is This fact correct ?
Yes.
fact 2. Is not it Strange that i need to
append some letters after the word find to
get a finder method name !! why not wrting a simple
method name ( say abcdfgrty () instead of
findXXXX() which will do the job ??You can... but it has to be called form a findXXXX() method :)
As such there is no problem in writng a
find_ANY_WORDS_HERE() to get a finder method but
problem is why i need to stick to the word
find and append some words after it
t to get a finder method ? if i had to do it
seriously then whats the role of the container ? how
w it is linking ?Once someone takes the pain of going through the EJB specs, he would not have a problem. Imagine each vendor using his own brains and the developer getting bugged with new features in each AS. EJB specs are flexible enough already :)
Maybe you are looking for
-
Internet issues on my new Macbook Pro.
I'm hoping someone might be able to shed some light on an issue I have been having! I've just got a new Macbook Pro, so late 2011 model and ever since having it I have had issues with the internet. Forgive me if I'm not able to explain very well what
-
can someone help me out i need some pictures off this phone and i am not sure it is posibble
-
Best way to style a column in an interactive report?
Since I'd rather not do it directly in the SQL used to populate the report, can someone suggest a clean way to style all cells of a given column from an interactive report? Perhaps all cells of interest can be addressed through jquey using the "heade
-
Using Statement rather than CallableStatement for stored proc execution
Cleary, if you need to extract output parameters from a stored procedure, then you must use a CallableStatement to execute it. However, if your stored procedure just returns a basic ResultSet, or performs a database update, is there any penalty to us
-
ACS 4.2.0 AAA-server-IP-address changing to 169.254.x.x
Hello, I have ACS 4.2.0.124.15 installed on a windows server 2008. In the configuration menu : network config > AAA server , the AAA-server-IP-address change to 169.254.x.x each time I disconnect the ethernet interface of the server. Allthough, th