Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26065

Re: The easiest framework for Java Database applications development released for production use

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: The easiest framework for Java Database applications development released for production use
Date 2011-02-07 21:33 -0500
Organization albasani.net
Message-ID <iiqa0q$q4v$1@news.albasani.net> (permalink)
References (1 earlier) <MPG.27b8fec562e57f9e9897c8@news.justthe.net> <iinp9v$765$1@news.albasani.net> <92e64642-b624-4598-beaa-c57540a30733@k22g2000yqh.googlegroups.com> <iioobf$h14$1@news.albasani.net> <55029b5a-726d-4e31-96b7-3de2adbe7f5d@d19g2000yql.googlegroups.com>

Show all headers | View raw


yaormaAdmin wrote:
> What would the code you would write to get the data from the
> message_table and echo it to the console in the example at www.yaorma.org
> look like?

You assume I would write code like that.  I wouldn't, normally.  In a toy 
example where everything fits in one 'main()' call, there's not much you can 
conclude about the utility of a framework.

The question isn't whether you can simplify a single call to a database for a 
single hard-coded query.  The question is whether you can build a robust, 
stable, extendible application backed by a database.  Knocking away a couple 
of 'close()' calls is of minor value in such a context.

But to answer your question for the toy example, something similar to

  public class Foo
  {
    @PersistenceContext( unitName = "pcontext" )
    private EntityManager em;

    public List <Message> findMessages()
    {
      final CriteriaQuery <Message> cq =
             em.getCriteriaBuilder().createQuery( Message.class );

      cq.select( cq.from( Message.class ));

      return em.createQuery( cq ).getResultList();
    }

    public static void main( String [] args )
    {
      System.out.println( new Foo().findMessages() );
    }
  }

Or I might use a JQL query instead of the 'CriteriaQuery'.  It's just that the 
criteria approach is amenable to generic treatment - my actual code has a type 
parameter for the 'Message' type.

-- 
Lew
Ceci n'est pas une fenêtre.
.___________.
|###] | [###|
|##/  | *\##|
|#/ * |   \#|
|#----|----#|
||    |  * ||
|o *  |    o|
|_____|_____|
|===========|

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-06 22:35 -0500
  Re: The easiest framework for Java Database applications development released for production use Lew <lew@lewscanon.com> - 2011-02-07 09:57 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 11:19 -0800
  Re: The easiest framework for Java Database applications development released for production use Lew <lew@lewscanon.com> - 2011-02-07 08:10 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 09:32 -0800
  Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-08 19:08 -0500
  Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 18:04 -0500
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 18:59 -0800
      Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 19:18 -0800
  Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-09 07:55 -0500
  Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-06 20:30 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-08 05:44 -0800
    Re: The easiest framework for Java Database applications development released for production use Steve Sobol <sjsobol@JustThe.net> - 2011-02-06 21:54 -0800
    Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 18:00 -0500
    Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-07 21:33 -0500
    Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-08 19:06 -0500
      Re: The easiest framework for Java Database applications development released for production use Wojtek <nowhere@a.com> - 2011-02-08 21:59 -0800
    Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-07 07:25 -0500

csiph-web