How to properly use a TX from a servlet...

Hi all...
          Is this the proper way to surround this servlet method with a TX? It doesnt seem to work because the relationships are not being maintained. The problem lies on the green line - It update the "CourseOffers" but not the "Enrollments" relationship. The first Assertion works, yet the second one fails! WHY - What am I missing????
          Thanks
          dave
          public void testRelations() throws Exception
          InitialContext ic = new InitialContext();
          UserTransaction tx = (UserTransaction)ic.lookup("javax.transaction.UserTransaction");
          tx.begin();
          //Create some DATA
          FacultyLocalHome facultyHome = (FacultyLocalHome)ic.lookup("FacultyLocalHome");
          FacultyLocal faculty = facultyHome.create("Computer Science","CMPT");
          ProfessorLocalHome professorHome = (ProfessorLocalHome)ic.lookup("ProfessorLocalHome");
          ProfessorLocal professor = professorHome.create(faculty, "Dr Bob");
          CourseLocalHome courseHome = (CourseLocalHome)ic.lookup("CourseLocalHome");
          CourseLocal course = courseHome.create(faculty, "Intro 2 Computing", 101,3,0,false);
          StudentLocalHome studentHome = (StudentLocalHome)ic.lookup("StudentLocalHome");
          StudentLocal student = studentHome.create(faculty, "Sally Doe","95302545");
          CourseOfferLocalHome courseOfferHome = (CourseOfferLocalHome)ic.lookup("CourseOfferLocalHome");
          CourseOfferLocal courseOffer = courseOfferHome.create(course, professor,2002,1,50);
          //Save counts before
          int courseOffersCountBefore = student.getCourseOffers().size();
          int enrollmentsCountBefore = student.getEnrollments().size();
          student.getCourseOffers().add(courseOffer);
          //Look at counts after (Both should be modified)
          assertEquals(courseOffersCountBefore +1, student.getCourseOffers().size());
          assertEquals(enrollmentsCountBefore +1, student.getEnrollments().size());
          //Delete the DATA
          student.remove();
          courseOffer.remove();
          course.remove();
          faculty.remove();
          professor.remove();
          tx.commit();
          [att1.html]
          

You can create custom ringtones with music in your iTunes library on your computer that does not include DRM protection. If you have a Mac running Snow Leopard or later, Apple includes at least one 3rd party app via the App Store for a Mac for creating custom ringtones. The one I've used is called Ringer, and I believe it was free or cost a couple of bucks. Creates the custom ringtone from your designated section of the song and places the ringtone in the appropriate location in your iTunes library to be selected under the Ringtones tab for your iPhone sync preferences with iTunes to be transferred to your iPhone.
I'm sure there are some free and paid 3rd party apps that provide the same for Windows.

Similar Messages

  • How can I use LDAP searching from OSX Lion Server to Mozilla Thunderbird?

    How can I use LDAP searching from OSX Lion Server to Mozilla Thunderbird?  We have a super awesome contacts server that works great for our Mac users.  About 30% of our company are on PCs, and I would like to use the Mozilla Thunderbird mail client for them.  I see that in Thunderbird I can set up LDAP searching, and would like to have this feature point to our contacts server.  I've tried several different settings, and looked all over the web, but could not find the proper way to configure this.  Does anyone know if this can be done, or if not, would have a better suggestion?  Thank you for your time!!

    try double clicking keychain acces should launch and ask if you want to install login, system, System roots
    A dialog box will launch asking where to install the cert since your configuring a vpn I would put the certificate it in system.

  • I can not find my playlists on apple tv. How can I use my playlists from itunes on apple tv ?

    I can not find my playlists on apple tv. How can I use my playlists from itunes on apple tv ?

    Hey luisathome,
    Thanks for the question. The following resource outlines how to setup Home Sharing between your Apple TV and computer:
    iTunes 11 for Mac: Play items in your iTunes library using Apple TV (2nd generation or later)
    http://support.apple.com/kb/PH12153
    Thanks,
    Matt M.

  • How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    cd,
    Insert the picture and position it as you desire
    Make sure the picture is set to Floating in the Wrap Inspector
    Arrange > Send Objects to Background
    Regards,

  • How do i use a tune from my itunes as a ringtone on my iphone

    how do i use a tune from my i tunes as a ringtone on my iphone 4g

    Instructions for both Windows and Mac users at this link:
    http://www.wikihow.com/Make-Ringtones-for-the-iPhone

  • HT4427 how do I use a song from iTunes as the ringtone for my iPhone 5?

    how do I use a song from iTunes as the ringtone for my iPhone 5?

    Google will find several free ways to create ringtones for iphone.

  • How to I use a music from my music as a ringtone on my iphone4s?

    How to I use a music from my music as a ringtone on my iphone4s?

    You can create custom ringtones with music in your iTunes library on your computer that does not include DRM protection. If you have a Mac running Snow Leopard or later, Apple includes at least one 3rd party app via the App Store for a Mac for creating custom ringtones. The one I've used is called Ringer, and I believe it was free or cost a couple of bucks. Creates the custom ringtone from your designated section of the song and places the ringtone in the appropriate location in your iTunes library to be selected under the Ringtones tab for your iPhone sync preferences with iTunes to be transferred to your iPhone.
    I'm sure there are some free and paid 3rd party apps that provide the same for Windows.

  • How can i use migration assistant from a Power PC G4 powerbook?

    How can i use migration assistant from a Power PC G4 laptop that can't run 10.5 to a new mini running Lion? Mini's MA says I have to upgrade the laptop's MA but the upgrade requires 10.5 as a minimum
    help,please
    jan

    That is correct. You'll need either an ethernet cable or a firwire cable and a firewire to thunderbolt adapter to connect the two macs together. Here's info on Migration/Setup assistant
    http://support.apple.com/kb/HT4889?viewlocale=en_US&locale=en_US

  • HT5467 how can i use location services from my pc to find my lost ipod?

    how can i use location services from my pc to find my lost ipod?

    Find My iPod
    http://www.apple.com/sg/icloud/features/find-my-iphone.html

  • How can I use my camera from sony xperia z2 on my laptop

    How can I use my camera from sony xperia z 2 on my laptop? Please help me Thanks!

    You need an app, something like this 
    https://play.google.com/store/apps/details?id=com.busywww.cameraremote&hl=en

  • How do I Display a string from a servlet into a JSP Page???? NEED HELP!!!!

    Hi guys,
    How do I Display a string from a servlet into a JSP Page...
    Ive tried so many bloody things!.....
    Simply.
    I get text from JSP. The servlet does what ever it does to the string.
    Now. Ive create sessions and bean things,.... how the hell do I display it in a text box... I can display on the screen.. but not in the text box.!!!
    please help!!!

    hmmm, I dont really like using JSP programming, u should be using JAVA..
    the way to do it is:
    Call and cast to the bean like this:
    <%@ page import="beans.*" %>
    <% //cast to bean get request create object
    userNameBean u= (userNameBean) request.getSession().getAttribute("userNameBean");
    then... all you do is call it like this:
    <input type="text" name="firstName" value="<%= u != null? u.getFirstName(): "" %>">
    this is the real programmers way,,,
    chet.~

  • How to Create an XML document from XSQL servlet which follows a particular DTD struct

    how to Create an XML document from XSQL servlet which follows a particular DTD structure.Could anyone send me a sample code for this.

    You'll need to associate an XSLT transformation with your XSQL page that transforms the canonical result into your DTD-valid format.
    For example, given an XSQL page like:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="rss.xsl" ?>
    <xsql:query max-rows="3" connection="demo" xmlns:xsql="urn:oracle-xsql">
    select title,id,description,url,to_char(timestamp,'Mon DD') timestamp
    from site_entry
    order by id desc
    </xsql:query>and an "rss.xsl" stylesheet that looks like this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" doctype-system="rss-0.91.dtd"/>
    <xsl:template match="/">
    <xsl:for-each select="ROWSET/ROW">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    <xsl:for-each select="ITEM">
    <item>
    <title><xsl:value-of select="TITLE"/></title>
    <link><xsl:value-of select="URL"/></link>
    <description><xsl:value-of select="DESCRIPTION"/></description>
    </item>
    </xsl:for-each>
    </channel>
    </rss>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>You produce DTD-valid output against the rss-0.91.dtd DTD that looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE rss SYSTEM "rss-0.91.dtd">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>

  • Using ejb service from a servlet in Weblogic 6.0sp1

              anybody had sucess using ejb service from a servlet in Weblogic
              6.0sp1 ?
              It worked in Weblogic 6.0. But in 6.0sp1, the servlet startup always
              return me "ClassCastException"
              when narrowing a lookup of an ejbHome to the specific class.
              Using this same ejb service from a standalone Java client wotked
              fine in both versions.
              Any body has aby clue ?
              Help greatly appreciated
              hyliu
              

    The ejbc'ed jar needs to be in the CLASSPATH of the servlet server.
              Gene
              "Haiyang Liu" <[email protected]> wrote in message news:3ab2670c$[email protected]..
              >
              > anybody had sucess using ejb service from a servlet in Weblogic
              > 6.0sp1 ?
              >
              > It worked in Weblogic 6.0. But in 6.0sp1, the servlet startup always
              > return me "ClassCastException"
              > when narrowing a lookup of an ejbHome to the specific class.
              > Using this same ejb service from a standalone Java client wotked
              > fine in both versions.
              >
              > Any body has aby clue ?
              >
              > Help greatly appreciated
              >
              > hyliu
              >
              

  • How can I use the photos from iphoto to display in contacts?

    Contacts has a space for a photo.  At one time I knew how to populate this space with photos from iPhoto. Currently my choices are to use an icon or take a pic with the camera.
    How can I add the photos from iPhoto to the choices for populating the "Contacts" image space for individual cards?

    See this Discussion...
    https://discussions.apple.com/message/19082703#19082703

  • How do  I use a variable from an Interface class?

    Right now I have three classes. First class is called Game and it extends my second class call Parent and also implements my third class call Source. Source is an interface class. I have a variable that I want to use in my Source class named Checker. Now, How do I go among using that variable from my Game class? What should the code look like?
    ex.
    public class Game extends Parent implements Source
    need help badly....

    ok, what I forgot to tell you guys is that my variable
    in my interface class is a boolean type(true or
    false). It is set to true now. But I want it to change
    to false when a user triggers a button in the Game
    class. How do I do this? You don't because you can't. If you have a varaible declared in an interface it must be static and final. It cannot, therefore, be changed. Better head back to the drawing board.

Maybe you are looking for