Best way to instantiate objects in one to one mapping.

Hi,
I have two objects with this basic definition:
@Entity
@Table(name="siteuser")
public class SiteUser {
     @Id
     @GeneratedValue(strategy=TABLE, generator = "UserAndSiteGen")
     @TableGenerator(name="UserAndSiteGen", table = "userandsitegen")
     long id;
@OneToOne(cascade=ALL)
     UserPointSummary pointSummary;
@Entity
@Table(name="userpointsummary")
public class UserPointSummary {
     @Id
     @Column(name = "USERID", insertable=false, updatable=false)
     long userID;
     @OneToOne
     @JoinColumn(name="USERID")
     SiteUser user;
Since the UserID is generated but is the primary key of the summary object is it possible for me to create the userpointtransaction for a user in a single transaction? If so how?
Even doing it in two separate transactions it doesn't seem to work. I tried having a constructor:
     public UserPointSummary(SiteUser user)
          this.user = user;
and code:
     user.setPointSummary(new UserPointSummary(user));
     service.persistSiteUser(user);
But I keep getting an error when trying to insert the UserPointSummary row that UserID cannot be null...
Please let me know if you have suggestions on the right way to approach this.
Thanks.

I think the issue was just that I didn't have one of the two set the mappedBy attribute. Now things seem to be working.

Similar Messages

  • GAME: best way to MOVE objects: tweenlite them or increment their x any values

    As the title says, need best way to move objects in game. Always used x and y increments. Read about tweenlite and use it, very easy. So which do I use taking into account that these games can be ported to mobiles ie: which is more optimized. It's a platform type game. I will have
    a. A little girl that walks and climbs
    b. Little platforms that slide from side to side - you have to jump on them
    c. The little girl will jump
    d. Little baddies will fly around the screen.
    ALSO, as the girl jumps I would like it to look natural
    a. Gravity as she falls down
    b. The correct increment on x and y as she jumps.
    Shouldn't their be an actionscript 3 games forum . anybody know a good site for that?
    Cheers in advance

    OK - I get the message. I should increment x.
    I must have phrased the question wrongly. I'm just looking at optimization techniques so when games go on mobile they work OK.

  • What is the best way to get PATHS from one Photoshop psd file to another?

    Hi! New on the site, and I signed up specifically to ask the best way to import one .psd file into another, including the paths on the paths palette.
    Almost all of my Photoshop drawings make heavy use of vector paths, which I then stroke using using PS natural-media brushes and the "stroke paths" function (usually with "simulate pressure" checked.) Also, my .psd files tend to be, um, HUGE... and I typically break up a whole drawing into separate PS files and then assemble all of them into one final finished graphic.
    I have no trouble moving raster stuff from file to file. Just put all the layers I want to transfer into a group and drag the group to the other .psd. Works fine, including layer masks. But I have not found a good way to get vector paths from the Paths palette of one .psd to another. Of course I can select paths and copy them to the Win clipboard, switch to the other .psd, and paste them back in. The drawback to that method is that I lose the correct size relation between the results of previously done "stroke paths" operations (on raster layers) and the paths that generated them. Sometimes the copied-in paths are way too large, sometimes way too small, never Just Right.
    As I'm sure most of you know, if you resize an entire Photoshop document from within PS, any paths it contains are correctly resized along with everything else. That's no longer true after grouped raster layers are dragged over to another document but paths are copied and pasted in. The size connection is lost. (Location placement, too.)
    I WANT those paths! After I bring a piece of a drawing into the full final drawing, what looked good when I was working on it separately often doesn't look right any longer and I want to re-stroke those paths using different brush diameter, opacity, etc., or maybe even a completely different brush.
    I've tried bring outside .psd files in as smart objects with the Place command but either that doesn't work or I'm not doing it right. Using Place, the paths in the Placed document don't come in at all.
    I'll be very grateful for any hints or strategies any of you knowledgeable folks can give me. Thanks very much!
    Jim
    Note, PS CS3 extended on Win 7 pro.

    Denny
    1. Connect the two macs - firewire, ethernet, sneakernet as suits you - and copy the iPhoto Library Folder from Old Machine to New Machine. Drag it from Home/Pictures to the same location on the new machine.
    2. Because all the files 'belong' to the account on the old machine, you have to update the file permissions: hence Download BatchMod from
    http://macchampion.com/arbysoft/
    And apply it to the iPhoto Library Folder using the settings found here:
    http://homepage.mac.com/toad.hall/.Pictures/Forum/BatChmod.png
    (Credit to Old Toad for this one).
    Note: This must be run on the new machine after copying the files over.
    3. Then launch iPhoto on the new machine.
    Regards
    TD

  • Best way to remote objects...

    What is my best option for hosting objects and accessing/instantiating them using Java SE and potentially other Java-based platforms (CDC, CLDC)?
    What I've been trying to do so far is set up some system where a Java SE program can connect to an application server and obtain references/instantiate objects on the server and call methods of those objects.
    The biggest struggle for me is understanding if JNDI is what I need to use for all this, on top of other questions.
    Am I going about this the wrong way? Is there something else I should be doing?
    I welcome any further questions or suggestions.

    Well...maybe, but also not quite?
    Is there any way I can get a more specific response? Is there any way I can run a server that hosts instances of objects? What is the simplest way I can instantiate and communicate with remote objects?
    Having a different stub for every class I create just seems like wasted effort and there are much more clumsy platforms out there that support very simple remote object & class features...

  • Best way to creat Objects

    Hi gurus,
    I am in a process of converting CRs to Universe. Based on the business area , I gathered a set of reports that to be converted to Universe. Joining of tables is almost done. Now I am in process of creating objects.
    As we are going in the Bottom- Up approach as the reports are already existed in CR. After analyzing couple of reports, I found lot of formula fields for one report which are in a set of ranges like 0-10, 10-20, 20-30 etc.., with Grand totals, %.
    Should I create each and every object like 0-10, 10-20 ( for one report, I have 50+ formula fields).
    Please suggest me the best way to go or any suggestion the Webi reporting part.
    Thanks
    RUC

    I would recommend creating object with formulas at universe level using universe functions and using Database functions. This will be very useful to create reports on demand. also give flexibility to user to create ad-hoc report.
    Also for specific formulas (which are very report specific) you can create them in universe and hide it from users if you don't want user to use them in ad-hoc reporting.
    for formulas like (Bucket)
    0-10, 10-20, 20-30
    you can use CASE WHEN functionality of database (I am assuming oracle here)
    like
    CASE
    WHEN [Obj] > 0 and [obj] < 10 then '0-10'
    END
    I hope this helps.

  • Best way to store objects' properties and later remake those objects?

    I want to create a bunch of objects, set their properties and then save that so on restart, the objects can be reconstituted. Is serialization the best way/ Some other way? I want to store them in XML so I can also create a GUI to show the objects stored.

    JoachimSauer wrote:
    6tr6tr wrote:
    I want to create a bunch of objects, set their properties and then save that so on restart, the objects can be reconstituted. Is serialization the best way/ Some other way?Serialization is definitely one way to do that.
    I want to store them in XMLUse JAXB or XMLEncoder/XMLDecoder.
    so I can also create a GUI to show the objects stored.What does a GUI have to do with writing XML? I don't see how that's in any way related.Thanks. What I meant was that I want to have a JTree populated easily with that info and I know there's good support for populating a JTree with XML.

  • What is the best way to move data from one array to another

    I'm going to be moving data from one array to a larger array on the same RAID but different controller. (I have some extra extra drives I'm also going to be installing Retrospect so I can't just restore from a backup.)
    The RAID has 450GB of production files, fonts etc.
    What is the best way to move the data over?
    I saw that someone had suggested using ditto. Would that be better than MacMV?
    I also own Bru LE so I could use that.
    Any advice would be appreciated.
    Thanks,
    Paul

    Ditto is a great option -- probably the best.
    ditto -rsrc src_folder /Volumes/targetvolume/targetfolder

  • Best way to sillo objects?

    I have to sillo jewelry, so it's very hard to use the Magic Wand since there are varying colors and brightness amongst all the silver/reflective surfaces. I have always used the Pen tool to make Paths but hate that hard edge it has. What is the ultimate, best way to do this? Backgrounds need to be white. If you're thinking to answer with photograph them on a white background, this has already been done. Photographed white is not "web" white and these objects must be silloed. Thanks for any help!

    Make the path.
    Go to the path palette.  ( I assume you know where to find this )
    select the path that you wish to apply into a selection.
    In the path palette there is a sub menu with options. It's located to the upper right of the path palette.  Looks like 3 horzontal lines with a very small up side down triangle next to it. Click on that.  The sub menu comes up.
    Find the command " make selection "
    set the feather radius to something like 0.5.  I assume you are editing an image at 300 dpi.  if 72 dpi, lower the number by half to start out.
    You may or may not want to select the Anti-aliased option depending upon the feather radius and or resolution of the file.
    click ok
    In the Layers palette, double click the background layer then click OK.
    At the bottom of the Layers palette there is a little icon that is a box with a circle in it.  Click on that. This will create the mask.
    Zoom into the image and evaluate the edge softness.
    If its not good enough, rince and repeat until you get the edge you want.

  • Best way to move securities from one Active Directory (AD) to another ?

    Hi experts,
    We are currently moving all our employees from several Active Directories (AD) to a Global active directory (GAD). So user accounts and all our BPC securities set up will keep being the same. Only the active directory has to be changed.
    What would be the best way to proceed to migrate all our current securities from our various AD to our new GAD ?
    We are on SAP BPC MS 7.0 SP3, SQL Server 2008
    Thanks for your help.
    Best regards,
    Ludovic

    If the name of somain will remain the same then you don't have to do anything from BPC point of view.
    You just to make sure that doing ping of "domain name" it will respond the new active directory GAD not the old one.
    If the domain name was changed then from BPC point of view we are speaking actually about complete different users.
    So the security must to be redone for all users.
    domain1\user1 is different by dmain2\user1.
    Regards
    Sorin Radulescu

  • What's the best way to maintain 2 libraries one lossless the other MP3?

    I'd like to have 2 music libraries one for home (lossless) and one for my iPhone (MP3). Not sure what's the best way to achieve this and maintain.

    To create or access a second (or more) library on a Mac, hold down the "Option" key (labelled ⌥ and/or alt) when launching iTunes: Using multiple iTunes libraries -Mac
    Note: You can only have one Library open at a time and iTunes will default to the last library opened if you don't use the keyboard command to choose one.

  • Best way for Java objects to relate to DB tables

    When creating a Java app which relies on a backend DB, it is convenient (and necessary) to create Java classes which relate to the data in those tables. However with a normalised set of tables, should the Java classes relate purely to the tables, or the "view" of the un-normalised data?
    e.g. (rough example of what I mean)
    CREATE TABLE teams
    team_id INTEGER NOT NULL PRIMARY KEY,
    team_name CHAR(50)
    CREATE TABLE users
    user_id INTEGER NOT NULL PRIMARY KEY,
    user_name CHAR(50),
    team_id INTEGER REFERENCES teams(team_id)
    Now, the Java class for a user could have either have a variable (e.g. teamName) declared as an int (to fully reflect the table design) or a String (to represent the "view" of the data). I know that views can be used etc. and in this example that would be very easy � I am just using these simplified tables as an example.
    I have tried both and both have pitfalls. For instance, when getting the data from the database, it is very easy to create the object from the DB if it reflects the �view� of the data. However when it comes to updating the data in the DB, you need to do a lot of other work to find out what needs updating in which tables, because the actual raw data (as will be inserted/updated with SQL commands) is not available in the Java object.
    I hope this makes sense.
    Thanks.

    My question is what is the best way to write the classes that represent the DB data. As I said this is not EJB (that would handle the DB side of things anyway), as this is overkill for this particular situation. It was more of a general question anyway - should the class contain the actual data (e.g. should the user Class contain a String for the team name (e.g. Purchasing) or a link to the underlying DB id for Purchasing.
    In reality, I would create a Team class, but the same applies - should the Java Class ever contain any relationship to the underlying DB. I think not, but it seems inefficient to have to continually query the DB to find out information we already have.
    Apologies if I am not explaining this very well.

  • What is the best way to append data from one field to another?

    I have the following table, table1:
    Name Null? Type
    MAIL_ID NOT NULL NUMBER(10)
    LAST_NAME VARCHAR2(45)
    FIRST_NAME VARCHAR2(45)
    MIDDLE_INITIAL VARCHAR2(1)
    ADDRESS_1 VARCHAR2(45)
    CITY VARCHAR2(35)
    STATE VARCHAR2(2)
    ZIP VARCHAR2(10)
    REMARKS VARCHAR2(200)
    The table has duplicate entries that need to be removed. The records that will be removed need the
    data in the Remarks column appended to the Remarks data of the record that is not deleted.
    For example, the following listing shows a sample of the duplicate records.
    Mail ID Last Name First Name M Address City St ZIP Remarks
    189 BROWN STEPHEN 6706 MOESER LN EL CERRITO CA 94530-2909 Sf7#s124,f16#d7996(NML)[Cl#117][Ml#1649][NMf1#d288][NCf9#d319][SNl#e62]
    211023 BROWN STEPHEN B 6706 MOESER LN EL CERRITO CA 94530 RLl#a12047[IDl#i398]
    287796 BROWN STEPHEN B 6706 MOESER LN EL CERRITO CA 94530 SNl#e1163
    The following listing shows how the kept record should appear after the duplicate records are deleted.
    Mail ID Last Name First Name M Address City St ZIP Remarks
    189 BROWN STEPHEN 6706 MOESER LN EL CERRITO CA 94530-2909 Sf7#s124,f16#d7996(NML)[Cl#117][Ml#1649][NMf1#d288][NCf9#d319][SNl#e62]RLl#a12047[IDl#i398]SNl#e1163
    I have the process of deleting duplicates working but have yet to determine the best way to move
    the Remarks data from the deleted records to the preserved record.
    I know there are probably various ways to approach this.
    Any suggestions will be greatly appreciated!
    Here is the sql for deleting duplicates.
    DELETE FROM table1
    WHERE mail_id in (SELECT mail_id FROM table1
              where not first_name = 'Null' and
    not last_name = 'Null' and
              not city = 'Null' and
              not state = 'Null'and
    not last_name = 'Anon'
              minus
              select min(mail_id) from table1
              group by first_name, last_name, city, state, address_1, organization, title);
    THANKS in advance!!!!

    Here's quick and dirty example probably a better way to do it, but this is what I came up with quickly.
    My table looks like this:
    MAIL_ID LAST FIRST PHONE REMARKS
    123 Ruff Shawn 555-555-5555 Called 10-10-04
    135 Ruff Shawn 555-555-5555 Called 10-12-04
    201 Ruff Shawn 555-555-5555 Called 10-19-04
    The code below will concatenate the remarks column from the rows, and delete the 135 and 201 rows, then update the 123 row with the concatenated remarks.
    declare
    l_remarks varchar2(500);
    l_min_mail_id number;
    begin
    select min(mail_id) into l_min_mail_id
    from test
    group by last, first, phone;
    select remarks into l_remarks from test where mail_id = l_min_mail_id;
    for i in (select mail_id, remarks from test
         where last = 'Ruff'
              and first = 'Shawn'
              and phone = '555-555-5555'
              and mail_id <> l_min_mail_id)
    loop
    l_remarks := l_remarks||','||i.remarks;
    delete from test where mail_id = i.mail_id;
    end loop;
    update test set remarks = l_remarks where mail_id = l_min_mail_id;
    commit;
    end;
    Hope this helps.

  • Best way to break up a one-hour video

    I have some 1-hour HD television programs stored as .m4p files. As I recall they are about 9GB each. When I bring them in to FCPX the work files are about 60 or 65GB. This is all fine. I have enough disk space in my Mac Pro to work with them.
    My question is: What's the best way to work with these files? Generally a 1-hour show will break down to seven or eight 5-minute to 8-minute segments. It's these that I want to edit. (Not for commercial purposes, of course.) What do you recommend to break up the 1-hour clip into half-a-dozen segments, to delete the commercials, and to have the separate clips in the Event ready to add keywords and move to the Project for editing?

    I would open the original file in MPEG Streamclip and export the various subclips as ProRes files from there, then import them into FCP X. MPEG Streamclip allows you to easily mark in and out points for that purpose.
    In any case, it is a free program so it won't hurt to try (and a tool that is useful for many occasions). I suppose Compressor may be an option also.

  • Best way to transfer data from one MBP to another

    Hi there,
    In few days time I'll be swaping MBP 15 Retina (os 10.9.3) for new one. Some thech issues with the current one. Have to send old and will get new.
    TM Backups runs automaticaly Airport Time Capsule (wireless).
    What is the best and safest way to transfer whole data?
    How to setup Time Machine? Any special settings for last backup before will send it?
    How to get all stuff back on the new one?
    About 150GB on HD.
    Thanks

    Make a bootable backup/clone of your current machine onto an ext HD. Better than restoring from TM. Then, when you get the new machine, on first boot (assuming whoever's providing it to you hasn't already set it up), follow the steps in Pondini's Setup New Mac guide, migrating from the bootable backup/clone.

  • What is the best way to move everything from one MacBook Air to another MBA

    I bought a new MacBook Air ( OS 10.6.4, 2.16 GHz, 4GB RAM) = MBA 2. I already have an old MBA (bought late 2009, OS 10.6.0, 1.86 GHz, 2 GB RAM) = MBA 1
    Whenever I had to do a clean install of the MBA 1, I was able to successfully restore all the files and the same architecture of the HD by cloning the MBA 1's HD (onto an external drive) before doing the clean install, then sticking the external drive into the USB port and then using Migration Assistant (selecting other drive in the choices).
    Another method I can use but haven't tried is by connecting the two MBAs together with an ethernet cable (I have ethernet adapters for the two MBAs) and then using Migration Assistant.
    If I use this method, do I have to change anything in Network (in System Preferences) like this person did?
    http://www.zdnet.com/blog/apple/macbook-air-diary-day-3-migration-assistance/125 3
    So the questions I am asking are:-
    1) Which is the better method (faster, more fail-proof, simpler) for migrating?
    External drive plugged into the USB port (with clone of the HD of the older MBA on it)
    OR
    Networking the two computers with an ethernet cable
    2) If I use the networking method, do I have to change anything in Network?
    3) The MBA 2 had 10.6.4 already installed on it. I have used the MBA 2 a little bit, adding browsers and so on, but there is nothing there I want to keep.
    Do I have to do a clean install (sticking the USB flash drive that came with the computer into the MBA 2 and then erasing the disk) before I use the Migration Assistant?
    OR
    Can I just delete all the applications and files I have added since I started using the MBA 2, and then just start up Migration Assistant?
    OR
    Can I just leave the MBA 2 alone and leave it as is and start Migration Assistant? Will the Migration Assistant write over everything that's currently on the computer? (I don't mind if it does.)
    4) Will it be a problem that the MBA 1 has 10.6.0 on it whereas the MBA 2 has 10.6.4 on it? Do I need to update the MBA 1 to 10.6.4 before I do the migration? (I'd rather not if I can avoid it. However, I plan to use 10.6.4 on the new MBA 2).
    Thanks for any replies.

    applecore_eater wrote:
    External drive plugged into the USB port (with clone of the HD of the older MBA on it)
    If the clone is already made, that will be somewhat faster.
    Can I just delete all the applications and files I have added since I started using the MBA 2, and then just start up Migration Assistant?
    Your best bet is to erase the disk, install OSX from the USB stick, then use +Setup Assistant+ when the new Mac restarts. See [Setting up a new Mac from an old one or its backups|http://web.me.com/pondini/AppleTips/Setup.html] (or use the link in *User Tips* at the top of the +Snow Leopard > Installation and Setup+ forum).
    4) Will it be a problem that the MBA 1 has 10.6.0 on it whereas the MBA 2 has 10.6.4 on it?
    No.

Maybe you are looking for

  • User defined Error Codes

    Hello,   I am using the "Bundle by Name" VI to insert error info into the Labview Error Cluster.   I am doing calculations and have assigned a -23096 to the error code and during program execution a dialog box pops up stating the following Possible r

  • Mm stock transfer in excisible scenario...

    Hi gurus, there are certain scenarios: 1)suppose i want to do sto from plant a to plant b. but both lie in different excisible zones. how is it mapped in sap . Give me detailed step by step (t.codes) 2) I purchased some raw materials for which i had

  • Archived log file not displaying

    While navigating around the "home" page for OCS as an administrator...I was trying to run a report under Reports>Conferences>Diagnostics. The links says: Click the link below to view comprehensive conference diagnostics. To see the log file correctly

  • Agent is Unreachable (REASON = Connection refused) but the host is UP

    Folks, Can I pick your brains, I keep recieving the smtp alert from Grid control which says; Agent is Unreachable (REASON = Connection refused) but the host is UP upto 5 minutes later the smtp mail is received Agent is Unreachable clear : <SERVER> -

  • Non standard baud rates serial support?

    1. I have a microcontroller board sedind data tp FT232R(usb uart IC) which then forms a COM port on PC to commnicate with labview serial visa. 2. I am able to communicate with standard baud rates with any problem like 9600 or 38400 bps. 3. I want to