Pojo used by many other objects

Hello all,
In my application I have got a complex entity containing lists and maps filled with data by the persistence tier and that entity is to be used by many other objects in my application, including many controllers. I am trying to find a way to access that pojo in the most practical way. For that I could use a kind of factory such as:
public final class MyPojoFactory
    private static MyPojo instance;
    public static MyPojo getInstance(){
    if(instance == null){
       instance = new MyPojo();
       return instance;
}and then access my pojo using the MyPojoSingleton.getInstance() method throughout the client part of my application. However, I am bit concerned about the thread safety of this implementation since instance is a static variable and that its state could be altered indeterministically.
What I've thought of is having a parent abstract class extended by all the classes that would need this pojo. But sometimes these classes hierarchy gets really deep and I end up with things like myClass.getParentClass().getParentClass().getMyPojo() if you see what I mean, which I would like to avoid.
Any solution or design pattern or simpler implementation I should have a look into?
Thanks a bunch,
Jimmy

Well thanks for this tip! But I've got another similar case where the service needs an id as parameter as such:
public final class MyPojoFactory
    private static MyPojo instance;
    public static MyPojo getInstance(long primaryKey){
    if(instance == null){
       instance = service.getData(primaryKey);
       return instance;
}In that case I don't think I could use my PojoFactory because the instance object has a global scope, doesn't it? How could I handle such a case?
Thanks again,
Jimmy

Similar Messages

  • Replace a subvi used in several other vi

    I have modified and renamed a subvi for convenience
    this subvi is used in many other subvi's and vi's
    I want to replace the previous by the new one in one time(like in visual c or word with text)
    Is It possible ???
    Can we make a macro to do it
    Thanks
    Christophe RAVARY

    > I have modified and renamed a subvi for convenience
    > this subvi is used in many other subvi's and vi's
    > I want to replace the previous by the new one in one time(like in
    > visual c or word with text)
    > Is It possible ???
    If the callers of the VI are loaded into memory when you save it to a
    new name, LV will automatically update them to point to the new
    name/location. If LV isn't open, you are using the explorer, or the
    calling VIs aren't loaded, then the way to do this is to use replace on
    each call, which can be alot of edits.
    So again, the technique is to load the caller, one at a time or all at
    once. Open the subVI and Save As... Change the name and when you close
    the callers you will notice they want to be saved also.
    Greg McKaskle

  • I have been using Safari for years and have always kept it on "private." Starting two days ago, I suddenly found myself unable to log onto my blog and many other sites that I normally log onto when private is set. Why?

    I have been using Safari for years and have always kept it on "private." Starting two days ago, I suddenly found myself unable to log onto my blog and many other sites that I normally log onto when private is set. This so annoying, I just switched to Firefox. I don't like Firefox nearly as much as I like Safari. What is happening? How do I fix the problem?
    Thank you.

    Might be a corrupted database ...
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.

  • How to Track the table using Trigger or any other Object

    Hi Folks
    I need to audit Inserts, deletions, updates  to inserted into other tracking table. I was planning on using a trigger to do this,
    Can you please help me how can I wright code for trigger for this. or else using any other object we can do this operation.
    can you please help me thanks in advance.
    Thank in advance.

    Also you can use an OUTPUT clause ( need to modify your DML operations)
    create table itest ( i int identity not null primary key, j int not null unique )
    create table #new ( i int not null, j int not null)
    insert into itest (j)
    output inserted.i, inserted.j into #new
    select o.object_id from sys.objects as o
    select * from #new
    drop table #new, itest;
    go
    The example below shows code that uses OUTPUT clause in UPDATE and DELETE statements to insert rows into an audit table.
    create table t ( i int not null );
    create table t_audit ( old_i int not null, new_i int null );
    insert into t (i) values( 1 );
    insert into t (i) values( 2 );
    update t
       set i  = i + 1
    output deleted.i, inserted.i into t_audit
     where i = 1;
    delete from t
    output deleted.i, NULL into t_audit
     where i = 2;
    select * from t;
    select * from t_audit;
    drop table t, t_audit;
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • I used this iphone wire for a bit, it worked perfectly but then suddenly i couldnt charge my phone and it stopped working completely. ive tried many other wires but they dont seem to work as well. im starting to get really frustrated

    i used this iphone wire for a bit, it worked perfectly but then suddenly i couldnt charge my iphone 5  and it stopped working completely. ive tried many other wires but they dont seem to work as well. im starting to get really frustrated and im really unsure of whats the case. i really really need help with this. please help asap!!

    Presuming you are using a wall charger - it would seem that your battery needs to be looked at in an Apple store

  • After updating to mavericks I have to constantly enter my apple ID for mail, iBooks, iTunes and many other applications that used to be part of my keychain. How can I get my log-in to work again?

    After updating to mavericks I have to constantly enter my apple ID for mail, iBooks, iTunes and many other applications that used to be part of my keychain. How can I get my apple ID log-in to work again?

    Several times I've re-entered my passwords under Preferences/Internet Accounts/iCloud and it won't save since I've installed Mavericks.  Also, the iCloud icon in the left column in Preferences/Internet Accounts/iCloud is greyed out but allows me to click on it to set-up.  When I click on iCloud the password is filled out but the "Enable this account" check-box is not checked.  I check it, and all seems correct.  The icon is no longer grey, the password is correct, the "activate this account" check-box is checked.  Then, when I launch mail, notes etc. I'm still prompted to re-enter my apple ID.  The log-in loop continues.  For years my keychain has worked perfectly.  What has changed in Mavericks?

  • Can you use objects as "cut outs" for other objects when they are only bitmaps?

    Hi, If this is possible, this would help me a TON.
    I am using Flash CS4 professional
    I will explain the issue. I have made a tree with a tree trunk and on top of the trunk I have made steps. I am making a Flash Game and you have to go up this steps to continue on the level, while being able to collide with the parts of the tree that aren't the steps. To do this, I would have to cut out the parts on the trunk that are the steps. I have already made the steps. It would take a long time to remake them when the trunk is isolated as a selection and delete the part. If there is a way to just put the already made steps on the bit map and then use it as some kind of cookie cutter-like thing, it would be VERY useful for many things. If something like this exists, or if there is any way to do something like this, PLEASE TELL ME !

    For all,
    This page has some Jabber info on linking to MSN amnd other service with the Jabber side of iChat (at the top_
    http://ralphjohns.co.uk/page5.html
    And in the Other Apps section number 11 and 12 point to two apps that can Video only from the Mac to MSN Buddies.
    9:16 PM Tuesday; February 26, 2008

  • When creating a remote address in a pot or other objects you cannot use a / for a address??? my ladders addresses contain such ////// symbols for some addresses?​??

    when creating a remote address in a pot or other objects you cannot use a  /  for a address??? my ladders addresses contain such ////// symbols for some addresses???

    On the AB object, "f" is a float and cannot address individual bits.
    Otherwise, you would replace the "/" with an "_".
    Forshock - Consult.Develop.Solve.

  • How to find which programs (and other objects) use the field LGORT

    Hi, Im an Abap freshman, and I have been asked to search all programs and objects that use the field LGORT (Storage Location), regardless of what table it is in.
    Is it possible to do it using the "Where-Used List"?
    This will be important since a new Storage Location will be created for MM, and we have to assure that no other programs that reference to it will be affected.
    I would appreciate any help. Thanks!!

    Hi George,
    Go to transaction SE11, choose radiobutton Data Element then enter the name LGORT. Now using the where-used-list in the toolbar, choose programs checkbox in the subsequent dialog and press enter. It should show all programs using the field LGORT irrespective of table name.
    Hope this helps.
    Cheers,
    Sougata.
    Using ECC6.0

  • I'm using Lightroom cc, I'm trying to create a develop preset. I'm making changes to one photo that I want to apply to many other photos, one of the changes is to blur the background using the adjustment brush. When I am blurring I am going over the photo

    I'm using Lightroom cc, I'm trying to create a develop preset. I'm making changes to one photo that I want to apply to many other photos, one of the changes is to blur the background using the adjustment brush. When I am blurring I am going over the photo several times, when I go to create the preset the adjustment brush is not an option to check. How do I add the adjustment brush to the develop presets. Thanks Ron.

    The adjustment brush cannot be added to a develop preset.
    If you can replace the adjustment brush with a gradient filter or radial filter, you can add those to a dev preset.
    If a gradient filter or radial filter is not an option for you, you can at least create an adjustment preset to remember your brush settings.

  • EDGE being used in 3G area. How many other people see this??

    I'm just trying to get a feel for how many other people see this.
    In the last 6 weeks or so, twice my phone has switched from 3G to EDGE when i'm in a strong 3G area. Yesterday it did it just as I was leaving work and my iPhone stayed on EDGE all the way back home, when I know that the area in question is fully covered by 3G (and my iPhone normally says 3G). Later at home I went to use the phone and noticed it had finally switched back to 3G instead of EDGE.
    Is this an area issue with AT&T getting overloaded? Is this a bug in the iPhone software? Anybody else experience this periodically?
    Mark.

    First off, it could either be an issue with AT&T's network being overloaded so it switched you to Edge, or it could be a bug in the iPhone software.
    Second, are you measuring the signal strength by how many bars the iPhone shows or by the dbm numbers? The dbm numbers show the actual signal strength and the bars don't. The iPhone could have a horrible signal and still show you 3-5 bars. To see the actual dbm numbers, you have to go into the phone feature and type in "star12345#3001#star" and hit send (be sure to place the * in place of the word star). Once you do that you will enter test mode and you will notice that there are numbers in the top left instead of the bars. The numbers range from (this is not the exact range because I don't know) -55 to -117. The lower the number the stronger signal you have, once you start hitting -100 your signal is getting pretty weak. If you want to continually be able to see the dbm numbers you have to force quit out of the field test mode. If you are on 3.x firmware you have to hold the sleep button until the power off slider appears, let go of the sleep button and then hold down the home button. Once the app closes you can now tap on the top left and switch between bars and dbm numbers.

  • (261718088) Q: Can you use xm:multiple with Objects other than String?

    Q: Can you use xm:multiple with Objects other than Strings?
    <br>
    A: You bet. Attached find a text file with some code from the example I showed
    today, a version of the multipleSayHiTo() method that has a parameter of an Array
    of Person objects rather than a parameter of an Array of Strings. The code within
    the text file comes from the Greeting.jws file (the Greeting Web Service).
    [multiple.txt]

    So you are saying that the recovery discs I made do include the copy of windows that was originally installed?
    Absolutely! They will restore the hard disk to its original out-of-the-box contents. Follow the instructions in the section Restoring from recovery DVDs/media, which begins on p. 73 of the User's Guide.
       Satellite A660 Series User’s Guide
    maybe i can make a deal with wd to have them swap this drive out for the BEKT instead...
    That would be a good idea in any case.
    As I said, the 10-fc12-045d error would not be due to the drive's being AFT, but more likely the discs are not being read properly. New discs can be obtained from Toshiba. Scroll down to Get Recovery Media here
    -Jerry

  • How to find object use in other object

    Hi All,
    I want to find one object for example procedure which is used in other object like function,procedure or view.
    How can i find it?
    Thanks in advance.

    user647572 wrote:
    Hi All,
    I want to find one object for example procedure which is used in other object like function,procedure or view.
    How can i find it?
    Thanks in advance.Use DBA_DEPEDENCIES view :
    SQL> create table my_tab (id number);
    Table created.
    SQL> create or replace procedure my_proc
      2  as
      3  p_id number;
      4  begin
      5  select id into p_id from my_tab;
      6  end;
      7  /
    Procedure created.
    SQL> select owner, name, referenced_name from dba_dependencies where referenced_name='MY_TAB';
    OWNER      NAME                 REFERENCED_NAME
    SYS        MY_PROC              MY_TAB
    SQL>

  • I still using 10.5.8 and i cannot tun firefox and many others application?

    after backup my hardisk i format my computer and after that i canot run firfox and many others application
    i try to use rapair but still same.

    Firefox 4 requires at least OS X 10.5 and an Intel Mac. There is a third party version of Firefox 4 that runs on OS X 10.4/10.5 and PPC Macs, for details see http://www.floodgap.com/software/tenfourfox
    If you prefer, you can get the latest version of Firefox 3.6 from http://www.mozilla.com/en-US/firefox/all-older.html

  • After a month of using CS6 Master, Acrobat ceased functioning. Many other customers with the same problem suggested deactivating Flash Pro to reactivate Acrobat. After following these instructions, the entire suite was deactivated and now dipalys a messag

    After a month of using CS6 Master, Acrobat ceased functioning. Many other customers with the same problem suggested deactivating Flash Pro to reactivate Acrobat. After following these instructions, the entire suite was deactivated and now dipalys a message that our trial that will expire in 10 days (in the middle of an upcoming charity event). Is there any way to reactivate CS6? Is the only option to delete all CS programs? Can we download CS6 again with the same product key?

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

Maybe you are looking for

  • ITune - Windows 8.1 Upgrade error : Installation success or error status: 1603

    Hello, When I try a upgrade itunes automaticaly ( IE, open iTunes and iTunes tells me there and update ), it fails to update. When I manually download the latest copy of itunes and double click to install it, it failes with :- iTunes installer comple

  • Expecting Suggestions !!! Career Shift from SAP Business Development to SAP R/3 Pre Sales

    Hello Everyone, I have been working as SAP Business Development Executive, with 5 years of Sales Background.Engaging with selling different SAP products. I feel, I should shift my profile as SAP R/3 Pre Sales Consultant, as i always passionate about

  • Keyword problem

    Major problem with keywording. I'm using the trial of 5.5 of lightroom. It was working fine with the first four directories of images I imported. Now I'm importing a directory of alphabet PNGs. I select all and add keywords. Save to file. Import a se

  • Opening in code view in CS5

    A while back I posted a discussion seeking information about having PHP files open in code view instead of design view. (CS4). I found out that I was able to tell PHP files to open in code view, but for some reason the creators of DW saw it fit to fi

  • Hawk 5770 Strange Power Behaviour

    Hello, I just purchased a MSI 5770 Hawk graphics card. I have what seems to be a power related issue with it. Let me explain.... After I install the card and I turn the PC on and I can hear all the pc fans and the Hawk fans power up and it's at that