EJB question....Help
I got a enterprise session bean that retrieves data from the database(MS Access). The bean also sets the data into some local variables. The question is, how do I retrieve those data back to my JSP pages and display it to the client?
This isn't exactly a "new to Java" topic, but - the short answer is you get a reference to the home interface of your session bean via a JNDI lookup, then call create to get your implementation, then just call a get method from that. Check out the tutorials or google for "accessing Session Bean from Servlet" or some such.
Good luck
Lee
Similar Messages
-
apple id is disabled, to reset the password I do not know the email and security question. help what to do?
Hi ingaosk,
Thanks for the question. Based on what you stated, it seems like you did not receive the reset email. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
If you didn't receive your Apple ID verification or reset email - Apple Support
Thanks for using Apple Support Communities.
Cheers,
Mario -
HT1349 I for get security question help my too rest , send to my mail :
I send email for serves and send to my by email ling I tray eat not help my to rest my security question .
No we to send security question to my email or what I down I tray from many days
The serves send that and it,s not help : read it
Hello,
The following information for your Apple ID *********** was updated on 02/03/2013:
Phone number(s)
If these changes were made in error, or if you believe an unauthorized person accessed your account, please reset your account password immediately by going to iforgot.apple.com.
To review and update your security settings, sign in to appleid.apple.com.
This is an automated message. Please do not reply to this email. If you need additional help, visit Apple Support.
Thanks,
Apple Customer Support
Tel my what I do I need my program and my many in my account and wan I need to seal program he asking security question , what I do
I for get security question help my too rest , send to my mail : ***********
<E-mail Edited by Host>Do not post your email adress here.
Open your browser and go to iforgot.apple.com and follow the instructions there. -
HT201363 I forget security question, help me recover?
I forget security question, help me recover?
You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
(104340) -
About Java 2 opaque font color question, help needed!
About Java 2 opaque font color question, help needed!
I was trying to test opaque font (the string has a foreground color and a background color), but i can't find the method for doing that.
i can change foreground by Graphics2D.setPaint(Color.black).
Anybody know how to change the background of the string?
Thanks!Hi. The way I'd do it would be to use the font metrics to find the length of a string and draw a rectangle and then drawstring over the rectangle. If you want an example, I can post it although I suspect theres a better way.
-
I forgot my security queStions help me!
I forgot my security queStions help me!
If you have a rescue email address set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
If you don't have a rescue email address set up then go to Express Lane and select 'iTunes' from the list of 'products' in the middle of the screen.
Then select 'iTunes Store', and on the next screen select 'Account Management'
Next choose 'iTunes Store Account Security' and fill in that you'd like your security questions/answers reset.
You should get an email reply within, I think, about 24 to 48 hours (and check your Spam folder as well as your Inbox) -
sister was using my iPod, she changed Apple id to hers, then forgot the iTunes password, now it's disabled she doesn't know what backup email she use or the security questions HELP can Apple reset my iPod?
Is there a way to find my Apple ID Name if I can't remember it?
Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
How do I change or recover a forgotten Apple ID Password?
If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.
Forgotten Security Questions/Answers
You need to contact Apple by:
1 - Use the Express lane and start here:
https://expresslane.apple.com
then click More Products and Services>Apple ID>Other Apple ID Topics>Forgotten Apple ID security questions.
or
Apple - Support -form iTunes Store - Contact Us
2 - Call Apple in your country by getting the number from here:
http://support.apple.com/kb/HE57
or
Apple ID: Contacting Apple for help with Apple ID account security
3 - Use your rescue email address if you set one up
Rescue email address and how to reset Apple ID security questions
For general information see:
Apple ID: All about Apple ID security questions -
HT5312 forgot the answers to security questions. help.
forgot the answers to security questions. help.
Contact iTunes Customer Service and request assistance
Use this Link > Apple Support iTunes Store Contact -
Hi
I am preparing for certification exam. I don't know the correct answer of these question. Please help me.
Regards
Arghya Banerjee
========================================================================
1. While testing a BMP Entity Bean, a developer discovers that a transaction rollback does not cause a rollback of the changes made to the bean as it should. Which of the following should the developer suspect?
A. The ejbPassivate() method has a bug.
B. The ejbStore() method has a bug.
C. The ejbCreate() method has a bug.
D. The datastore does not support JTA.
E. The transaction does not implement javax.transaction.UserTransaction.
Select 2 answers.
2. A Servlet must perform 3 operations that are independent of one another. They are time consuming with each operation consuming about 10 msec of CPU. The Servlet's response depends on the completion of all three operations. The developer decides to perform each operation on a separate worker thread to run them concurrently. Which of the following describe important parts of this implementation?
A. The Servlet should implement MultiThreadModel
B. The Servlet should implement SingleThreadModel
C. Access to the HttpSession must be synchronized.
D. The worker threads must not write to the ServletOutputStream.
E. The worker threads must not read from the ServletInputStream.
Select the best answer.
3. A client invokes the create() method on an CMP entity bean. Which of the following is a correct sequence in which the operations mentioned below are performed?
a. Container creates an EJBObject.
b. EJB home object invokes ejbCreate() on Bean instance
c. Bean instance is associated with EJBObject.
d. Container creates new bean instance.
e. Container calls setEntityContext() on bean instance.
f. Container creates the bean representation in a database.
g. ejbPostCreate() method is invoked on bean instance.
A. b -> f -> a -> c -> g
B. b -> a -> f -> c -> e -> g
C. a -> d -> c -> b -> e -> g -> f
D. a -> d -> c -> b -> f -> g -> e
E. a -> c -> e -> b -> f -> g
Select the best answer.
4. A Web site is getting a lot of 'hits' and the amount of session data managed by the server is becoming too large for it to handle. Which of the following are appropriate ways to solve the problem?
A. Expand the capacity of the server.
B. Add additional servers to share the load.
C. Store the session data in a Cookie.
D. Store all session data in hidden fields on the web pages that are served.
5. A developer wishes to make a server function available to an applet via a Servlet. The applet passes the Servlet a serialized object as an argument. How should the developer implement the Servlet?
A. Sub-class HttpServlet and create an ObjectInputStream from the
ServletInputStream in the doGet() method.
B. Sub-class HttpServlet and create an ObjectInputStream from the
ServletInputStream in the service() method.
C. Sub-class GenericServlet and create an ObjectInputStream from the
ServletInputStream in the doGet() method.
D. Sub-class GenericServlet and create an ObjectInputStream from the ServletInputStream in the service() method.
Select the best answer.
6. While testing a CMP Entity bean, a developer discovers that a change to one of the bean's properties is not being reflected in the database that contains the bean data. What are possible causes?
A. The ejbStore() method has a bug.
B. The ejbCreate() method has a bug.
C. The setter for the property has a bug.
D. The mapping of container managed fields to database fields has a bug.
E. The deployment descriptor has a bug.
F. The ejbLoad() method has a bug.
Select 4 answers.Hi Arghya ,
From where you have taken these quetions , are they from the book.
1. While testing a BMP Entity Bean, a developer
discovers that a transaction rollback does not cause a
rollback of the changes made to the bean as it should.
Which of the following should the developer suspect?
A. The ejbPassivate() method has a bug.
B. The ejbStore() method has a bug.
C. The ejbCreate() method has a bug.
D. The datastore does not support JTA.
E. The transaction does not implement
javax.transaction.UserTransaction.
Select 2 answers.
D,B If the Transaction is rolled back there are the possibility that either the datasource doesnot support it or the bean is updating the inconsistent data, so mostly problem in ejbStore() where there is a database update.
2. A Servlet must perform 3 operations that are
independent of one another. They are time consuming
with each operation consuming about 10 msec of CPU.
The Servlet's response depends on the completion of
all three operations. The developer decides to perform
each operation on a separate worker thread to run them
concurrently. Which of the following describe
important parts of this implementation?
A. The Servlet should implement MultiThreadModel
B. The Servlet should implement SingleThreadModel
C. Access to the HttpSession must be synchronized.
D. The worker threads must not write to the
ServletOutputStream.
E. The worker threads must not read from the
ServletInputStream.
Select the best answer.
Now here what is the worker Thread should not write to output stream as if it does then there will be wrong formatting of the data, we are bothered about to improve the throughput so we have spawned three worker thread.Also there is no dependency so D is proper one
3. A client invokes the create() method on an CMP
entity bean. Which of the following is a correct
sequence in which the operations mentioned below are
performed?
a. Container creates an EJBObject.
b. EJB home object invokes ejbCreate() on Bean
instance
c. Bean instance is associated with EJBObject.
d. Container creates new bean instance.
e. Container calls setEntityContext() on bean
instance.
f. Container creates the bean representation in a
database.
g. ejbPostCreate() method is invoked on bean
instance.
A. b -> f -> a -> c -> g
B. b -> a -> f -> c -> e -> g
C. a -> d -> c -> b -> e -> g -> f
D. a -> d -> c -> b -> f -> g -> e
E. a -> c -> e -> b -> f -> g
Select the best answer.
Client invokes the create method on the home which inturn prepares the EJBObject and attaches the bean instance to the EJBObject and returned the reference to the client.So the option E.
>
4. A Web site is getting a lot of 'hits' and the
amount of session data managed by the server is
becoming too large for it to handle. Which of the
following are appropriate ways to solve the problem?
A. Expand the capacity of the server.
B. Add additional servers to share the load.
C. Store the session data in a Cookie.
D. Store all session data in hidden fields on the web
pages that are served.
You have to use the Load balancing tech , go for distributed technology B , the processing speed is now the criteria so you distribute the work.
5. A developer wishes to make a server function
available to an applet via a Servlet. The applet
passes the Servlet a serialized object as an argument.
How should the developer implement the Servlet?
A. Sub-class HttpServlet and create an
ObjectInputStream from the
ServletInputStream in the doGet() method.
B. Sub-class HttpServlet and create an
ObjectInputStream from the
ServletInputStream in the service() method.
C. Sub-class GenericServlet and create an
ObjectInputStream from the
ServletInputStream in the doGet() method.
D. Sub-class GenericServlet and create an
ObjectInputStream from the ServletInputStream in the
service() method.
Select the best answer.
I have to refer some docs for this
6. While testing a CMP Entity bean, a developer
discovers that a change to one of the bean's
properties is not being reflected in the database that
contains the bean data. What are possible causes?
A. The ejbStore() method has a bug.
B. The ejbCreate() method has a bug.
C. The setter for the property has a bug.
D. The mapping of container managed fields to database
fields has a bug.
E. The deployment descriptor has a bug.
F. The ejbLoad() method has a bug.
Select 4 answers.
If there is the problem in the deployment descriptor then there ejb will not deploy at all .As the problem comes in updating I can make so no problem in the ejbCreate() also , but then many other consideration has to be taken .So I have my answer as
A,C,D,F
That is all I can say.
Regard
Vicky -
EJB Doubts/Questions - HELP
Hi All,
I am new to EJB technology and i am learning EJB without training canter. I am just going through Java EE tutorials available on www.oracle.com .
My knowledge of EJB Session bean say:
1. Stateful Session Bean : Maintains the client state.
2. Stateless Session Bean : Does not maintain the client state.
Now I am developing Shopping Cart Example using EJB, Servlet, JSP and HTML pages.
My Project contains following pages:
1. login.html
2. AuthenticateServlet.java
3. User.jsp
4. PurchaseServlet
5. PurchaseSuccessful.jsp
6. AuthenticateBean – Stateful Session Bean
7. AutheticateBeanRemote – Remote Interface of Authenticate Bean
8. PurchaseBean – StatefulSession Bean
9. PurchaseBeanRemote -- Remote Interface of PurchaseBean
Session Bean with its remote interface is maintained in the ejb package.
Login.html contains;
1. textbox named “txtUser”
2. Password textbox named “txtPass”
3. Submit Button
On submitting the credentials, it will check for the authentication in the AuthenticateServlet.
AuthenticateBean contains
public boolean authenticate(String user, String pwd)
if(anylogic)
return true;
else
return false;
The above method is exposed in AuthenticateBeanRemote Interface.
2. AuthenticateServlet contains
I have done lookup of AuthenticateBeanRemote and have created abr. Below some important code of AuthenticateServlet;
String user = request.getParamter("txtUser") ;
String pwd = request.getParamter("txtPassr") ;
boolean flag = abr.authenticate(user,pwd);
if(flag)
// then it will direct the control to User Page
else
out.println("Failure");
User.jsp page will show me the UserID and some task that the authenticated user can do.
My question: is while redirecting the page to User.jsp from AuthenticateServlet, do I need to do URLRewritting to maintain the session or do I need to create separate HTTPSession Object or does the Stateful session bean will take care of session management on its own. i.e. no need to do anything, just transfer or redirect to User.jsp page .
User.jsp has purchase catalog of which the user will select products and click on purchase. On clicking purchase, it will take us to PurchaseServlet.
My question Now in the PurchaseServlet if I have written the code to access the methods in PurchaseBean, Whether it will be a guarantee that the authernticated and currently logged in user is accessing the methods so that only that person’s purchased items are visible and no mishap will occur regarding the user integrity.
PurchaseBean only contains the method to add the amount.
My Question: if at the same time 2-3 users are logging in the application, then whether by using the statefulsession bean, user integrity is maintained. OR do I need to use some other approach.
Please help me... I know these questions are silly but that’s the way the technology can be learned.user8687589 wrote:
Please help me... I know these questions are silly but that’s the way the technology can be learned.You are SO wrong. You learn it by:
a) reading and studying
b) really understanding not only the technology but also the theory behind the technology
c) learning how it works, why it works, when it works and when you should or shouldn't use it
A common denominator here is that you apply thought, reason and intelligence to get not only the basics but the big picture. Don't learn how to use it: UNDERSTAND it. That does not include just demanding all the answers in a forum and expect to have the answers spoon-fed to you. First read and study, then we'll talk. -
Beginner Question - Help Needed for EJB QL Sample Application
I'm working with a group of student interns, like myself, and we've been given an assignment to work with Oracle. All of us have no training or experience with this, so we're just learning as we go.
I've been trying to run the EJB QL Sample Application (http://www.oracle.com/technology/sample_code/tech/java/ejb_corba/ejbql/Install.html), but I keep running into problems at step 3.
Now, we will deploy the sample application onto OC4J. Open another command prompt and go to the folder <OC4J_HOME>/j2ee/home and run the following commands one-by-one
> java -jar admin.jar ormi://<machine_name>:<admin_port> admin <admin_pwd> -deploy -file <SAMPLE_HOME>/build/ejbql.ear -deploymentName Ejbql
> java -jar admin.jar ormi://<machine_name>:<admin_port> admin <admin_pwd> -bindWebApp Ejbql ejbql-war http-web-site /ejbql
where,
<machine_name> Name of the machine where OC4J Server is running
<admin_port> Admin Port on which the OC4J server listens. This value by default is 23791 unless explicitly changed by the user
<admin_pwd> Adminstrator password to access OC4J. The default value is welcome
When I do this step I get this error:
Error: Unable to find java:comp/ServerAdministrator: Lookup error: javax.naming.
AuthenticationException: Invalid username/password for default (sds); nested exc
eption is:
javax.naming.AuthenticationException: Invalid username/password for defa
ult (sds)
com.evermind.client.orion.AdminCommandException: Unable to find java:comp/Server
Administrator: Lookup error: javax.naming.AuthenticationException: Invalid usern
ame/password for default (sds); nested exception is:
javax.naming.AuthenticationException: Invalid username/password for defa
ult (sds)
at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminCo
nsole.java:105)
at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminConsole.java
:27)
javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException
: Invalid username/password for default (sds); nested exception is:
javax.naming.AuthenticationException: Invalid username/password for defa
ult (sds) [Root exception is javax.naming.AuthenticationException: Invalid usern
ame/password for default (sds)]
at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:153)
at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminCo
nsole.java:102)
at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminConsole.java
:27)
Caused by: javax.naming.AuthenticationException: Invalid username/password for d
efault (sds)
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2410
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2226
at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java:1692)
at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:727)
at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:134)
... 2 more
---- Embedded exception
javax.naming.AuthenticationException: Invalid username/password for default (sds
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2410
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2226
at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java:1692)
at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:727)
at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:134)
at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4jAdminCo
nsole.java:102)
at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminConsole.java
:27)
Any suggestions to fix this error?
Thanks in advance for any help.George,
The Readme.html file is available with the ejbqlsample.jar downloadable (Extract and find the doc in Ejbql\docs\Readme.html) which is printable.
Or,
If you are trying to print the file directly from OTN site, you need to set the Page-Setup Orientation to 'Landscape'.
Hope this helps.
Regards
Pushkala -
Stateless Session Bean + EJB Question + Jboss
Hello,
If I have a stateless session bean on a linux machine and it works locally what do i need to do to access a method in the session bean from a remote windows machine.
I would like to be able to execute my client jar file on a windows machine and have it access the jboss server on the linux machine. what do i need to do?
i have the session bean working locally on both windows and linux machine. do i need to to have a JSP/Servlet to access the session bean? can the session bean not be accessed directly? what should my classpath look like? do I need to include extra jar files in my client jar file.?
Thanks,
JoyceThanks guys for the help but I am still a little lost.
My Client windows machine has the client jar file and all the other jar files. This is my client class
package helloworld.client;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Hashtable;
import java.util.Properties;
import helloworld.interfaces.HelloWorldHome;
import helloworld.interfaces.HelloWorld;
public class HelloClient
public static void main(String[] args)
Hashtable prop = new Hashtable();
prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
prop.put ("java.naming.provider.url","jnp://172.16.220.160:1099");
prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
try
Context ctx = new InitialContext(prop);
Object obj = ctx.lookup("ejb/helloworld/HelloWorld");
System.out.println(obj);
HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
HelloWorld helloWorld = home.create();
String str = helloWorld.sayHelloEJB("JOYCE is COOL");
System.out.println(str);
helloWorld.remove();
catch(Exception e)
e.printStackTrace();
I get a NullPointer ie the home object is null. The IP address is the IP of the Linux machine that has Jboss running on.
Questions are:
1. Do I need to have Tomcat running on my client machine if I am to connect via HTTP? Does this alter my client code.?
2. My JNDI lookup is what is causing the problem. Does my jboss.xml and my ejb-jar.jar look okay to you.
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>helloworld/HelloWorld</ejb-name>
<jndi-name>ejb/helloworld/HelloWorld</jndi-name>
</session>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
ejb-jar.jar
<?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 >
<description>No Description.</description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session >
<description><![CDATA[No Description.]]></description>
<ejb-name>helloworld/HelloWorld</ejb-name>
<home>helloworld.interfaces.HelloWorldHome</home>
<remote>helloworld.interfaces.HelloWorld</remote>
<ejb-class>helloworld.session.HelloWorldBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
Do I need RMI ? Do I need to concern myself with CORBA? All Im looking for is a step by step to understanding what I need to configure? Is their some way I can debug?
Thanks alot,
Joyce -
Dear fellow Java developers:
I have a very straightforward question regarding ejb deployment using weblogic. In using the "jar" command of java, I have seen in various tutorials on ejb various uses of the command and want to know what is in fact happening.
Question 1:
the command:
c:\jar cvf PRE_HelloworldEJB.jar -C ejb_build META-INF -C ejb_build com
---------> what does the -c command mean, and what does the line
"-C ejb_build META-INF -C ejb_build com" do?
Question 2:
what is the difference between
c:\jar -cv0f tmp_day05_SignOn.ar META-INF day05
and this line:
c:\jar cvf PRE_HelloworldEJB.jar -C ejb_build META-INF -C ejb_build com
other than the name of the files? I mean what is the difference between jar -cvf and jar -cv0f????
Question 3:
In the following line:
c:\java weblogic.ejbc -keepgenerated -g -deprecation build\tmp_day05_SignOn.jar build\day05_SignOn.jar
what is the function of -keepgenerated -g -deprecation??? are they required?
Question 4:
what do the commands -g and -d mean?
I am sorry for the simplicity of the questions, but I am trying to be thorough. I appreciate any and all help.
Take care.
Sincerely;
FayyazAs far as weblogic commands are concerned the options tht u have asked are
-d : sets the destination directory for the generated XML files. This directory must exist before you run DDConverter
-keepgenerated :saves the intermediate Java files generated during compilation.
-C is a jar option that switches to a specified directory and includes the following file/files
jar cf0v does not do any zip compression.it stores only
hope that helps
cheers
sicilian -
Transaction & non-EJB objects (helper)
hi i have a question about transactional behavior of non-EJB objects. i'm
using
weblogic 6.0 sp1 with ejb 2.0.
say i have a session bean which starts a container managed transaction. and
it calls
out to helper class A(non-EJB), and that helper class A get a connection and
update
some tables. after A returns, session bean calls helper class B(non-EJB) in
the
same transaction. B is supposed to update some other tables but it throw an
user
exception. would the transaction in the session bean be rolled back? would
it
also roll back the changes made by helper class A?
thanks for any help,
z
Thanks Rob!
"Rob Woollen" <[email protected]> wrote in message
news:[email protected]...
> Ziqiang Xu wrote:
>
> > hi i have a question about transactional behavior of non-EJB objects.
i'm
> > using
> > weblogic 6.0 sp1 with ejb 2.0.
> >
> > say i have a session bean which starts a container managed transaction.
and
> > it calls
> > out to helper class A(non-EJB), and that helper class A get a connection
and
> > update
> > some tables.
>
> You must get the JDBC connection from a TxDataSource.
>
> > after A returns, session bean calls helper class B(non-EJB) in
> > the
> > same transaction. B is supposed to update some other tables but it
throw an
> > user
> > exception. would the transaction in the session bean be rolled back?
>
> Merely throwing an exception from a helper class will not rollback the
> transaction.
>
> Within an EJB, the best way to rollback a tx is to use the
> EJBContext.setRollbackOnly method.
>
> So you could do something like this:
>
> session_bean_method() {
>
> try {
> B.foo();
> } catch (MyException e) {
> ctx.setRollbackOnly();
> throw e;
> }
>
> }
>
> > would
> > it
> > also roll back the changes made by helper class A?
> >
>
> If they are all within a single transaction, then yes. As I mentioned
before,
> make sure that you use a TxDataSource for all of your JDBC Connections.
>
> -- Rob
>
> >
> > thanks for any help,
> >
> > z
>
-
Hi
guys!
I am newbie to EJB,A question puzzled me much these days.Help me plz :)
I know the EJB include three objects:EJBObject,EJBHome and XXXBean,The EJBHome object create EJBObjects by Facatory pattern.But,The EJBHome is an Interface,so does its subclass,How can an interface use create() method creating an EJBHome Object?
I don't know wthere I describe the question clearly .example as follws:
public interface Converter extends EJBObject{
public bussinessMethod1();
public interface ConverterHome extends EJBHome{
Converter create() .....;
//Client
Converter currencyConverter=home.create();//<===
//I can't understand it!home is an interface,and it isn't implemented(or only because i do not find out it )
the same question occered when I use the Serilizable interface,a class implement theSerilizable interface,then it is serilizable,too.but in the Serilizable interface,i can't find any clue How the serilizable works.
It maybe a stupid question,but ,Help me PLZ!
Thanx for your time!
kind regards
elantFirst, a typical EJB is made up of a HOME, REMOTE and a BEAN. You are correct, your HOME and REMOTE are interfaces. The BEAN is your implementation class.
Converter currencyConverter=home.create();//<===
//I can't understand it!home is an interface,and it
isn't implemented(or only because i do not find out itWhat happens here is your application server will generate a subclass of your HOME interface and implete the create method. That method will, among other things, call the ejbCreate() on your BEAN.
the same question occered when I use the Serilizable
interface,a class implement theSerilizable
interface,then it is serilizable,too.but in the
Serilizable interface,i can't find any clue How the
serilizable works.To begin understanding the Serializable interface, take a look at the javadoc found at http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html You may also wish to look for the tutorials found on the java.sun.com website.
Hope this helps.
Maybe you are looking for
-
Purchase Requisition are not getting generated for External Procured Materi
Hello PP Guru, The is a issue which the client is facing. The requirement is as follows There is material which is externally procured. They do the MRP run by using MDBT. Now the problem is Planned orders are getiing generated instead of Purchase req
-
I have an apple id that is not in use I made a typo at one time( and this id is close to mine in spelling) and this ID keeps popping up on my phone.I do not have a password for this ID and I want to delete it permenantly How do I do it
-
Is anyone experience display resolution problems on MBP15"I7 after OS Lion install?
I installed OS Lion on my MacBook pro 15" one week ago. I have installed the 10.7.1 update. Like many, I have experienced a dramatic slowdown in performance - Aperture is now unusable. My most immediate problem is that the display has lost its sharp
-
I just bought 80GB new ipod, after I installed Itunes 7.0 software and try upload my photos. But I couldn't find ipod source pane which supposed to be at R/H lower corner. But It doesn't show on itune after I pluged in Ipod to computer. also, not sho
-
Form inputs generated by HttpPortletRendererUtil.portletParameter contain .
Hi, I'm creating JSP portlets and have to sumbit values from a HTML form. I'm using HttpPortletRendererUtil.portletParameter to generate unique form input names. I'm following the forminput.jsp sample. All is fine but now I want to build some javascr