Is it Possible to Combine Hibernate + Swing?????

Hi Xperts,
Is it possible to combine Hibernate + Swing?
(My Point of View Hibernate Contains Transaction, Session... But In Swing Session??????)
So i have lot of confusions.
SO
if Hibernate + Swing
IF YES. HOW? ELSE TELL THE REASON.
I EAGERLY WAITING FOR YOUR REPLY
Thanks
Edward and Hari

Hi Duffymo - thanks for responding. It's fun to discuss this with somebody; I don't usually get many reasonable/friendly responses on the Hibernate user forum.
What I mean by transaction based identity is thatin
the normal, recommended Hibernate process (one
session per transaction), objects fetched in
different transactions do not == each other. Solet's
say I do the following:
* Start session 1 and transaction 1, fetch object
with primary key 5, and store it in variable obj1.
Commit transaction 1 and close session 1.
* Start session 2 and transaction 2, fetch object
with primary key 5, and store it in variable obj2.
Commit transaction 2 and close session 2.
* At this point, even though they represent thesame
row in the database, obj1 != obj2. I'll assume you mean !obj1.equals(obj2)here, because [obj1 != obj2[/code] even without
Hibernate if the two references point to different
locations in memory in the same JVM. The equals
method can be overridden. You can decide to check
equality only examining the primary keys, or you can
do a field by field comparison. If the class checks
equality on a field by field basis, the only way
they'll not be equal is if you change values.I really do mean == in this case. If those two fetches happened within the same session, Hibernate would return the identical object from it's cache. Here's some pseudo-code illustrating what I mean:
Session firstSession = sessionFactory.openSession(); //Start an empty session
Transaction tx1 = firstSession.beginTransaction();
Object obj1 = firstSession.get( Person.class, new Long(5) ); //Fetches row 5 from the database
tx1.commit();
Transaction tx2 = firstSession.beginTransaction(); //Start a new database transaction, but still use the same session cache.
Object obj2 = firstSession.get( Person.class, new Long(5) ); //Just returns the same object it previously fetched
tx2.commit();
obj1 == obj2; //Returns true, because we're pointing to the exact same objects
obj1.equals( obj2 ); //Obviously returns true since they're pointing to the same object
Session secondSession = sessionFactory.openSession(); //Start an empty session
Transaction tx3 = secondSession.beginTransaction(); //New transaction in the empty session, no cached objects
Object obj3 = secondSession.get( Person.class, new Long(5) ); //Returns a newly created object, not in our session cache
tx3.commit();
obj1 == obj3; //Returns FALSE, these are two separate objects because they were fetched by different sessions.
obj1.equals( obj3 ); // Depends on whether the database row was modified since we fetched obj1
It sounds like you want an Observer pattern, where
every client would deal with a single model and
changes are broadcast to every registered Observer.
That's just classic MVC, right? In that case, every
y client might have an individual view, but they're
all dealing with the same model. Changes by one is
reflected in all the other views in real time.That would be awesome, but doesn't seem feasible. Our Swing clients are spread all around the world, and creating a distributed event notification system that keeps them all in sync with each other sounds very fun but extremely out of scope for this project. We're trying to make Hibernate manage the object freshness so that our Swing application clients may slowly become out of date, but when we trigger certain actions on the client (like a user query, or the user clicking a 'refresh' button) they refresh portions of their data model from the central shared database.
>
The reason that this is pertinent is because Swing
expects objects to be long-lived, so that they canbe
bound to the UI, have listeners registered withthem,
they can be used in models for JTables, JLists,etc.
In a typical complex Swing application, your only
choice is to use a very long-lived session,because
it would break everything if you were getting
different copies of your data objects every timeyou
wanted to have a transaction with the database. As
shown above, a very long-lived session will leadto
very out-of-date information with no good way to
refresh it.Maybe the problem is that you don't want copies of
the data. One model. Yes?One data model with real-time updates between all the connected clients would be ideal. However, I don't think that Hibernate is designed to work this way - it's really not even a Hibernate issue, that would be some separate change tracking infrastructure.
Realistically, what I was hoping for is that we could have a single long-running Hibernate session so that we're working with the same set of Java objects for the duration of the Swing application lifetime. The problem that I'm running into is that Hibernate does not seem structured in a way that lets me selectively update the state of my in-memory objects from the database to reflect changes that other users have made.
Certainly you've used JDBC. 8) That's what
Hibernate is based on. TopLink is just another O/R
mapping tool, so it's unlikely to do better. JDO
doesn't restrict itself to relational databases, but
the problem is the same.You're right, I have used JDBC, in fact we wrote a JDBC driver for FileMaker Pro so I'm pretty familiar with it. What I meant is that I've never tried using raw JDBC within a Swing application to manage my object persistence.
I have not used TopLink and I haven't heard much about it, but I did see some tidbits on an Oracle discussion board comparing Hibernate with TopLink that made it sound like TopLink had better support for refreshing in-memory objects. Not having used TopLink myself, I can't say much else about what it's strengths/weaknesses are compared to Hibernate. It's not really an option for us anyway, because you have to pay a per-seat licensing charge, which would not work for this project.
I know almost nothing about JDO except that it sounds really cool, is pseudo-deprecated, and it's probably too late for us at this point to switch our project to use it even if we wanted to.
I don't think the problem is necessarily the
persistence; it's getting state changes broadcast to
the view in real time. It's as if you're writing a
stock trading app where changes have to be made
available to all users as they happen. Fair?Yes, I agree that the core issue is getting state changes broadcast to the view, but isn't that within the responsibility of the persistence management? How are we supposed to accomplish this with Hibernate?
An excellent, interesting problem. Thanks for
answering. Sincerely, %Likewise. I would stress again that I'm not anti-Hibernate in general (well maybe a little, but that's mostly because of bad attitudes on the support forums), I just have not found a way to make it work well for a desktop GUI client application like Swing. Thanks for your help, and I would love to continue the conversation.

Similar Messages

  • Is it possible to combine multiple Pur Reqs for multiple materials to one vendor into one PO through MD07?

    We have material planners who use MD07 (traffic signal screen) Stock/Requirements List, Collective Access tab to review material requirements by MRP Controller.  Once the list is created, they select individual materials and review them in MD04.  In a lot of cases, Purchase Reqs (PRs) are reviewed and adopted into POs individually for each material.  Sometimes they will combine multiple PRs for one material into one PO.  This is a good practice.  However, from what I have found, it is not possible to combine multiple PRs for multiple materials into one PO.  If this was done it would dramatically reduce the number of POs that we are issuing to suppliers.  Problem statement:  We issue too many POs which causes additional influxes down the line (receiving dock/goods receipts processing, receiving issues, invoices, invoice issues, etc.).  Does anyone know of a way to address this problem without a major overhaul in approach or customization of the system?  Thank you in advance!   

    Hello Michael
    As far as I know, this is not possible directly from MD07, only from the MM transactions.
    The following thread suggests the following procedure to convert several PRs into one PO:
    Conversion of multiple PR into single P.O
    Drag and drop the first PR from the item overview to the shopping card on top of ME21N,
    then open the PO detail delivery schedule tab and drag  and drop all other PR to the shopping card shown  in the schedule tab
    You can use the same procedure, calling the order conversion from MD07 and then drag and drop another PRs into this PO.
    BR
    Caetano

  • Is it possible to combine multiple pdf's into one without saving them onto your computer?

    Hello
    I open pdf's in an application (no add ons for acrobat exist), and want to combine them without having to use time on saving them before merging them into one single document.
    Is it possible to do this without having the files saved onto your computer? I use acrobat x pro.

    I dont think you understand my question. Of course Adobe reader cant combine pdf's, if it could I would not have had to purchase Adobe acrobat.
    The problem I am trying to solve is how to combine pdf files when they are not opened/saved locally on my computer.
    If I make Acrobat the standard program for opening pdf files on my computer - then will it be possible to combine the files that are opened without saving them first?
    I dont have the program installed on my computer now, and have to know this before we purchase it.

  • Is it possible to Combine photostream in iphoto?

    Hello,
    It woud be great if It is possible to combine more single photostreams into one iPhoto application.
    My wife and daughter have each their own iCloud account. But we would like That The photos come together in iPhoto without syncing with My iMac.
    Is this at the moment possible?
    Best Regards,
    Bart Collet

    I agree, this would be a great addition to iPhoto, for it to support multiple photo streams. Currently my work around is to have my iCloud account be the primary on my wife's iPhone with all features turned off excluding Photo Stream, and then her account is an additional iCloud/email account with all features turned on (except Photo Stream).
    One major downside to this is that all of her backups are going against my iCloud quota.
    You should submit iPhoto Feedback to request this feature/enhancement.
    http://www.apple.com/feedback/iphoto.html

  • Is it possible to combine 2 Threading Database Items?

    Is is possible to combine multiple Threading Database Items in HCM Extract? I am trying to extract the Personal Details ( i.e just Employee Name, Person Number, Primary Email Address etc.) and Assignment Details (i.e. Salary Details, Department, etc.) in file. I need to extract the new employees and changes using Threading Database item option. Please let me know the relevant option for it or let me know how can we combine Person and Assignment Threading Database Items.

    I am not HCM expert so I am not sure what "combine multiple Threading Database Items" means in this context. You may find this blog post covering various tools useful specifically the link to the HCM extract documentation that contains a concrete example ..
    Jani Rautiainen
    Fusion Applications Developer Relations                             
    https://blogs.oracle.com/fadevrel/

  • Is it possible to combine a address list with a Pages document and a data base in Numbers, the equivalent of "Mail Merge" using Microsoft?

    Is it possible to combine an address list with a Pages 5.1 document and a data base in Numbers 3.1, the equivelent of Microsoft "Mail Merge"?

    It is possible in Pages 09 and Numbers 09 but not in the versions you name.

  • Possible to combine photo libraries?

    Presumably as a result of setting up my iMac and using it before running Migration Asst. to transfer files from an old G4, I ended up with two photo libraries. I intend to erase my hard drive for other reasons. I believe I have all data folders copied onto an external hard drive and the photo libraries are separately copied. I also have Time Machine back-ups on a separate EHD but don't want to use that since I intend to start clean.
    Is it possible to combine the photo libraries by carrying them in from the EHD to the "clean" hard drive? If so, what steps should be followed?
    My apologies if this has been addressed before and I just didn't find the answer. A link to the answer would be welcome if it has been addressed.
    Thanks for any assistance.
    Steve

    Welcome to the Apple Discussions.
    You can merge iPhoto Libraries using the paid ($20) version of iPhoto Library Manager. It's the only way to do this.
    Regards
    TD

  • Is it possible to combine SDN account into OSS account?

    Hi Friends,
       I had a SDN account and now I got my OSS account.when I want to go to http://sdn.sap.com and I will login this forum with my OSS account automatically. It seems it is because of my setting of SAP Passport in my OSS profile. It is not so convenient when I want to check/manage my threads, which were posted by my SDN account. So I want to know it is possible to combine my SDN account into my OSS account. (for example, accredit all my SDN thread into the name of my OSS account, or link my oss account to SDN account, etc).
    Thanks very much.
    Joe

    here you are: Merge - User Accounts!!

  • Possible to combine Panther into one disk?

    Hello,
    I own my own set of Panther disks.. I wanted to know if its possible to combine all three disks into one DVD? Has anyone did that or ever attempted to do so?
    From Tiger onward all my disks have been DVD's naturally.

    Even if the three CD images were burned to a DVD disc, the natural scripting which
    runs at intervals during the original installation process may be asking for a second
    CD when the image is already available; and so on. However, there may be a way
    to work around that if someone is really clever or extremely focused.
    If a DVD had three install disc images on there (seen on desktop as three CDs)
    the natural script to' Eject disc 1 and ask for disc 2' etc; may be unnecessary.
    However, this does get into an area where Discussions may be not the correct place
    when the details may invoke some rule breaking; even if unintentionally directed there.
    This does get into some speculative and perhaps 'end user rule' areas best left alone;
    especially outside of ones secret clandestine laboratory in the basement? LOL.
    Wonder if there's a USB flash drive method of making a backup copy, that'd work?
    I'd hate to think the original, hard to find install disc set, would be lost or damaged.
    Usually, a clone of the installed system is adequate; for one computer at a time.
    Good luck & happy computing!

  • CE -possible to combine different multiple enterprise services? and expose

    can some one please let me know if there is any possibility to combine multple services into one and expose as a new  service in CE 7.1/7.2?

    You have multiple options:
    1. Create a WSDL which has input similar to input of WS1 (only Region as input) and an output similar to output of WS3.
    Create Proxy Service based on this WSDL. Then call all the thee business services one after the other and doing transformations/assigns as needed after each call. Finally map the result of BS3 to the similar output of your new WSDL on which the Proxy service is based.
    2. Create an Any XML type of web service. Create a schema which has two elements, one for input and one for output. Input containing only Region and output containing all the details. All consumers need to send request according to input defined in schema and expect output defined in schema. Its similar to creating the WSDL but can be used in case your consumer do not want to call a Web Service but want to call an XML API over HTTP. Rest will be same as option 1.
    Split join is needed to make calls in parallel, it wont be usable in your use case unless you expect a list og regions in the same request for each of which you need to gather same information by calling three services.

  • Is it possible to combine JOptionPanes

    Hi, i'm trying to write a cute program for my sister to help her with her math, no anything fancy.
    However, i was wondering weather it was possible to combine an Input JOptionPane and an Option JOption Pane, meaning it has a text area for an Input and buttons like cancel and stuff.
    Thanks in advanced for any answers.

    well, i read the link.. and got waaaayyy to confused.. moreover it did not show the example i needed. a specific example would be very welcome as i'm preety much a newbie in Java (going to the Uni only in 3 yrs) so if you could please explain it in more of a lamen terms, or give a code example, i'd be gratful. Thanks for the link tho, it was informative.

  • Possible to Combine LR Slideshows??

    Is it possible to combine 2 or more slideshows that were created in LR.
    Each slideshow has different music and "opening and closing" slides.  I'd like to maintain these differences while stitching them together so that I can make one seemless video.
    My guess is that this isn't 'in the cards' for LR.  If that's true, can you recommend some other software option(s) where this can be done?
    I appreciate your help.
    Chris

    Proshow Gold or Proshow Producer are good for that sort of thing (although they aren't the cheapest pieces of software in the world!)
    Phil

  • Is it possible to combine multiple IR into one Internal order?

    Hi,
    Is it possible to combine multiple internal requisitions into one internal order in OM? Thanks
    Regards
    Leo

    Oracle Order Management provides one to one mapping between Order and (orig_sys_document_ref & Order source). You may need to go for custom solution to consolidate requisitions to create a single internal sales order.

  • Is it possible to combine two pivot report into one ?..

    Is it possible to combine two pivot report into one ?..
    Then trying to display a chart or table result.

    Thanks for the reply.
    Let me explain it briefly. I am creating a Report 1 based on one fitler condition and second report is created based on second filter condition.
    I have similar column (time periods) in the both report. Then measure column has to combine and show as single report.
    This is my requirement.

  • Is it possible to combine two or more different apple accounts to one account?

    Is it possible to combine two or more different apple accounts to one account?

    No, you can't combine accounts nor transfer content between accounts - content will remain tied to the account that downloaded it.

Maybe you are looking for

  • How can we load a flat file with very, very long lines into a table?

    Hello: We have to load a flat file with OWB. The problem is that each of the lines in the file might be up to 30.000 characters long (up to 1.000 units of information in each line, 30 characters long each) Of course, our mapping should insert these u

  • How Can i do a excel graphic with jsp?

    have to create an excel graph in jsp taken there values of a database. thanks a lot, Federico.

  • Planned order numbers- reached maximum number

    Hai, We reached the maximum limit on Planned Order numbers (table PLAF). anyone had this situation before and if so how did you resolve it? Thanks in advance, Sonali

  • Automatic Billing For third party

    Hiya Can we have a automatic trigger for trade invoice? Once the vendor invoice is received and trade invoice should be triggered/created. However I would also like to check that trade invoice only be created for received quantity. Bit specific... an

  • What's the max number of servlet managed by Tomcat ?

    Hi all, I am start working on a pretty old web project; in this project there are no JSP pages, but only Servlets; there about 440 Servlets...these Servlets generate HTML output. Well, I'd like to know if Tomcat has any limit about the number of Serv