Package timforce

Examples of timforce.Quote


      Iterator iter = quotes.iterator();

      out.println("<tr><th>ID</th><th>Quote</th><th>Author</th></tr>");

      while(iter.hasNext()) {
        Quote quoteIter = (Quote) iter.next();
        out.println("<tr>");
        out.println("<td>" + quoteIter.getId() + "</td>");
        out.println("<td>" + quoteIter.getSaying() + "</td>");
        // Author author = quoteIter.getAuthor();
        // out.println("<td>" + author.getName() + "</td>");

        // Integer authorId = quoteIter.getAuthorId();
        // out.println("<td>" + authorId + "</td>");

        Author author = quoteIter.getAuthor();
        out.println("<td>" + author.getName() + "</td>");
        out.println("</tr>");
      }

      out.println("</table>");
View Full Code Here


    Transaction tx = null;

    try {
      try {
        tx = session.beginTransaction();
        Quote quote = new Quote();
        // quote.setId(new Integer(11));
        quote.setSaying("To be or not to be");
        session.save(quote);
        tx.commit();


        // List quotes = session.find("from Quote quote where quote.id < 5");   hibernate 2
        Query query = session.createQuery("from Quote quote where quote.id < 5");
        List quotes = query.list();
        System.out.println("HQL - List = " + quotes);

        System.out.println("\nIterate over results ...");
        Iterator iter = quotes.iterator();
        while(iter.hasNext()) {
          Quote quoteIter = (Quote) iter.next();
          System.out.println("  quote id = " + quoteIter.getId());
          System.out.println("  quote saying = " + quoteIter.getSaying());
        }
      } catch(Exception e) {
        System.out.println("ERROR - Exception =" + e);
        if(tx != null) {
          tx.rollback();
View Full Code Here

    Transaction tx = null;
    try {
      try {
        tx = session.beginTransaction();
        Quote quote = new Quote();
        quote.setSaying(sayingParam);
        session.save(quote);
        tx.commit();
      } catch(Exception e) {
        System.out.println("##### AddQuote#actionSaveQuote - Error - " + e);
        if(tx != null) {
View Full Code Here

      Iterator iter = quotes.iterator();

      out.println("<tr><th>ID</th><th>Quote</th><th>Author</th></tr>");

      while(iter.hasNext()) {
        Quote quoteIter = (Quote) iter.next();
        out.println("<tr>");
        out.println("<td>" + quoteIter.getId() + "</td>");
        out.println("<td>" + quoteIter.getSaying() + "</td>");
        Author author = quoteIter.getAuthor();
        out.println("<td>" + author.getName() + "</td>");
        out.println("</tr>")
      }

      out.println("</table>");
View Full Code Here

    Transaction tx = null;

    try {
      try {
        tx = session.beginTransaction();
        Quote quote = new Quote();
        // quote.setId(new Integer(11));
        quote.setSaying("To be or not to be");
        session.save(quote);
        tx.commit();


        List quotes = session.find("from Quote quote where quote.id < 5");
        System.out.println("HQL - List = " + quotes);

        System.out.println("\nIterate over results ...");
        Iterator iter = quotes.iterator();
        while(iter.hasNext()) {
          Quote quoteIter = (Quote) iter.next();
          System.out.println("  quote id = " + quoteIter.getId());
          System.out.println("  quote saying = " + quoteIter.getSaying());
        }
      } catch(Exception e) {
        System.out.println("ERROR - Exception =" + e);
        if(tx != null) {
          tx.rollback();
View Full Code Here

    Transaction tx = null;
    try {
      try {
        tx = session.beginTransaction();
        Quote quote = new Quote();
        quote.setSaying(sayingParam);
        session.save(quote);
        tx.commit();
      } catch(Exception e) {
        System.out.println("##### AddQuote#actionSaveQuote - Error - " + e);
        if(tx != null) {
View Full Code Here

TOP

Related Classes of timforce.Quote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.