Results 1 to 5 of 5

Thread: Entitymanager handling with JPA in Swing application

  1. #1
    Join Date
    Apr 2010
    Posts
    74

    Entitymanager handling with JPA in Swing application

    I am working in web applications I use for the session handling / EntityManagerHandling OpenEntityManagerInView the pattern using Spring. How do I implement in my Swing application with Spring and JPA (Hibernate) on the elegant EntityManagerHandling? Most of all it would be if the session would be open all the time and I do not need to worry when I can use Lazyloading and when not. As you that have been realized? Please tell me something so that I can resolve my doubt.

  2. #2
    Join Date
    Apr 2008
    Posts
    193

    Re: Entitymanager handling with JPA in Swing application

    In Swing applications you will not have a chance OpenSessionInView the pattern were to be applied. There is just no filter in the request to open a Hibernate session and closes again after rendering. In the Java Magazin 4.08 there is an article about the PreLoad pattern that can be used as an alternative. The LazyLoading by the Property triggers configuration in DAO (if the session is still open) and not in the GUI.

  3. #3
    Join Date
    Dec 2008
    Posts
    202

    Re: Entitymanager handling with JPA in Swing application

    It eats problematic indeed. But if you have a dialogue, can you look at it as kind of "request", and corresponding Session Management installed. However, one must consider carefully how the life cycle of such Session must look. Just had similar problem, but my sprincht SWING client with the backend server via RMI and hibernate still lives there.

  4. #4
    Join Date
    Dec 2008
    Posts
    161

    Re: Entitymanager handling with JPA in Swing application

    If this is resolved, several options are available. Starting with "To Fu" to (my preferred solution). The prepared DI container (in my case pico-container start) and take out DAO (DAO this session has already Hibernate) when you are done, stop the container. Nice thing is the complete one from the initialization code in the interface decouple it. I'm just thinking an art of the XWork framework to create (Or XWork to adapt), so that it can be used in Swing.

  5. #5
    Join Date
    Mar 2008
    Posts
    227

    Re: Entitymanager handling with JPA in Swing application

    The problem is that the Swing classes are not jumping beans. Since I am novice swing, I'm not even sure whether and how to configure Swing classes in Spring. In the Dao, which would of course be feasible, but not what I want. I will indeed call several Dao and business methods within a Hibernate session, from a swing class. It would be possible, the DI also apply to the Swing classes, and it is not strictly necessary. Much more interesting it would be the data and actions Model configure automatically with DI. But for a framework is needed, which manages the actions and sits on the River event. It would be possible XWork modify it, or a simple framework to write.

Similar Threads

  1. Jms + swing
    By Prince$O$Persia in forum Software Development
    Replies: 5
    Last Post: 24-07-2010, 03:30 AM
  2. Running the Java Swing application in a Web browser
    By Namuchi in forum Software Development
    Replies: 5
    Last Post: 23-07-2010, 03:33 AM
  3. Is File handling in Java Swing possible
    By Vivan in forum Software Development
    Replies: 5
    Last Post: 20-07-2010, 11:51 PM
  4. What are JFC and Swing?
    By DANIEL 602 in forum Software Development
    Replies: 5
    Last Post: 14-02-2010, 04:11 AM
  5. Replies: 2
    Last Post: 07-02-2009, 05:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,481,614.33306 seconds with 17 queries