HowTo: construct Composite key using other composite key?

Hello. I don' undestand how is it possible to do.
Please, see my code:
@Entity
@Table(name = "Person", schema = SCHEMA)
public class Person {
     @Id
     @GeneratedValue
     @Column(name = "id")
     private int id;
     private String medialogyUid;
     private String firstName;
     private String lastName;
     private String patronymic;
     private String biography;
@Entity
@IdClass(Convocation.PK.class)
@Table(name = "Convocation", schema = SCHEMA)
public class Convocation {
     @Id
     private int number;
     @Id
     @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
     private Institution institution;
     private Date beginDate;
     private Date endDate;
     public Convocation(){
     public Convocation(Institution inst, int number, Date beginDate, Date endDate){
          this.institution = inst;
          this.number = number;
          this.beginDate = beginDate;
          this.endDate = endDate;
     public static final class PK implements Serializable {
          public int number;
          public int institution;
          public PK(){
          /**@param number is convocation,number
           * @param institution is convocation.institution.id
          public PK(int number, int institution){
               this.number = number;
               this.institution = institution;
          @Override
          public boolean equals(Object o) {
               if (!(o instanceof PK))
                    return false;
               PK oPK = (PK)o;
               return this.number == oPK.number && this.institution  == oPK.institution;
          @Override
          public int hashCode() {
               return ((number == 0) ? 0 : new Integer(number).hashCode()) ^ ((institution == 0) ? 0 : new Integer(institution).hashCode());
//And finally the last class:
@Entity
@IdClass(DeputyMandate.PK.class)
@Table(name = "DeputyMandate", schema = SCHEMA)
public class DeputyMandate {
     @Id
    @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
     private Person person;
     @Id
     @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
     private Convocation convocation;
     private Date dateIn;
     private Date dateOut;
     public static final class PK implements Serializable {
               //don't know what to use @Embeddable or what?
    }I want DeputyMandate to use composite key. This composite key is based on Person with simple key +(int id)+ and Convocation PK.
Please, tell me how can I make composite key DeputyMandate.PK using simple key from Person and composite key from Convocation.
Edited by: Holod on 27.08.2008 15:52

And
CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_ITEM_ID,CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_ITEM_ID,CONFIG_OPTION_ID)
?

Similar Messages

  • Re-construct the key from byte[]

    Hi,
    I am constructing the key as follows:
    KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
    keyGenerator.init(128);     
    Key key = keyGenerator.generateKey();
    I intend to use this key for Encryption/Decryption etc. Then, I am getting the byte[] of the key as follows:
    byte[] keyBytes = key.getEncoded();
    Now, it there any way to re-construct they original key from keyBytes.
    Any help in on this is highly appreciated.
    Thanks,
    Ajas.

    OK...
    I found the way...
    try {
    // Generate a key
    KeyGenerator keyGen = KeyGenerator.getInstance("DESede");
    SecretKey key = keyGen.generateKey();
    // Get the bytes of the key
    byte[] keyBytes = key.getEncoded();
    int numBytes = keyBytes.length;
    // The bytes can be converted back to a SecretKey
    SecretKey key2 = new SecretKeySpec(keyBytes, "DESede");
    boolean b = key.equals(key2); // true
    } catch (NoSuchAlgorithmException e) {

  • TS4050 iCloud on Safari will not open Reminders -- I've tried using other browsers, and all other iCloud apps are fine. Any ideas?

    -- I've tried using other browsers, but no luck
    All other iCloud apps are fine via Safari (mail, calendar, etc.). Any ideas?
    I've tried clearing cache, logging in and out, switching off iMac.
    I'm using latest OS X and Safari versions.
    The problem seems to have crept to my iOS devices, which now register non-sync'd versions of my reminders lists, and which will not update via iClou

    Gawd, how have you managed not to update it?! The current version is Version 3.1.2 (4525.22)!
    Small wonder it won't work with 10.4.11.
    Have you ever used Software Updater to check whether there are any updates available for your Mac?
    I would recommend that you download the latest version from here:
    http://www.apple.com/safari/download/
    But please make sure that you download the version for Tiger and not for Leopard.
    BUT before you do so, and before you install it, please go through the following routine:
    Repairing permissions is an important part of regular maintenance, and should always be carried out both before and after any software installation or update.
    Go to Disk Utility (this is in your Utilities Folder in your Application folder) and click on the icon of your hard disk (not the one with all the numbers).
    In First Aid, click on Repair Permissions.
    This only takes a minute or two.
    Background information here:
    http://docs.info.apple.com/article.html?artnum=25751
    and here:
    http://docs.info.apple.com/article.html?artnum=302672
    If you were having any serious problems with your Mac you might as well complete the exercise by repairing your hard disk as well. You cannot do this from the same start-up disk. Reboot from your install disk (holding down the C key). Once it opens, select your language, and then go to Disk Utility from the Utilities menu. Select your hard disk as before and click Repair.
    Once that is complete reboot again from your usual start-up disk.
    More useful reading here:
    Resolve startup issues and perform disk maintenance with Disk Utility and fsck
    http://support.apple.com/kb/TS1417
    If all is OK, install the new Safari, and REBOOT, then repair permissions again.

  • Using other VPN software to connect to FON or Open...

    Presumably it's possible to use other VPN software other than the BT-supplied Cisco VPN to connect to wireless hotspots - are there any FAQs or Howtos on how to do this?

    Gordonbp wrote:
    Presumably it's possible to use other VPN software other than the BT-supplied Cisco VPN to connect to wireless hotspots - are there any FAQs or Howtos on how to do this?
    I installed sipdroid on my new Desire Z.  It works like a charm:  a kind person called Ewan produced an instruction for doing it, but Murphy's Law dictates I binned it only yesterday    If no-one picks up on this and posts a link to the original instruction I'll try reconstructing it.
    John

  • Using iPad mail program I have a draft of an email. I attempted to "cancel" and "delete draft" but it is still on my screen even after shutting down and restarting. How do I exit so that I can use other mail functions?

    Using iPad mail program I have a draft of an email. I have attempted to "cancel" this and "delete draft" but the email stays on my screen. How can I exit this so that I can use other email functions?

    Try closing the Mail app completely and see if it works properly when you re-open the app : from the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work also do a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • I have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me

    i have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me???

    If Join was on then your home wi-fi must be set to Non-Broadcast.  If you did not set this up (maybe your provider did) then you will need to find the Network Name they used, and any password they used.  The SSID is Security Set ID and to see more try http://en.wikipedia.org/wiki/SSID .  Basically it is the name used to identify your router/network.  A lot of times the installer will leave it set as LinkSys, or Broadcom or whatever the manufacturer set it as for default.  Your best bet is to get whoever installed it to walk you through how they set it up, giving you id's and passwords so you can get in.  HOWEVER, if you are not comfortable with this (if you set security wrong, etc.) you would be well ahead of the game to hire a local computer tech (networking) to get this working for you.  You can also contact the vendor of your router and get help (if it is still in warranty), or at least get copies of the manuals as pdf files.  Sorry I can't give you more help, I hope this gives you an idea where to go from here to find more.

  • Can i use other application on ipad such as microsoft excel or word? how?

    can i use other application on ipad such as microsoft excel or word? how?

    'Normal' PC and Mac (OS X) software do not work on the iPad (iOS), they are different operating systems. You can only install apps from the iTunes App Store on your computer or the App Store app directly on your iPad.
    Numbers (http://itunes.apple.com/us/app/numbers/id361304891?mt=8) and Pages (http://itunes.apple.com/us/app/pages/id361309726?mt=8) are two options, as are third-party apps such as Documents To Go :
    'normal' version : http://itunes.apple.com/us/app/documents-to-go-office-suite/id317117961?mt=8
    premium version : http://itunes.apple.com/us/app/documents-to-go-premium-office/id317107309?mt=8

  • How do i use my fingerprin​t for uses other than login? (email, web forums, etc)

    I was wondering, is there a way to use your fingerprint in place of a password for other uses other than logging into windows?  Some uses would be internet email {specifically gmail), logging into web forums (like this one).  Maybe (this is probably hopeful thinking)  configure your fingerprint to includepersonal data when filling out forums such as address, DOB, phone number, etc.  I will be using Firefox almost exclusively, but if theres a solution for IE i'll listen too.
    T61 15.4" T9300 (2.5GHz 6MB L2) Windows 7 Professional x64 4GB Memory, NVidia Quadro NVS 140M

    ThinkVantage Client Security Solution includes Password Manager which is close to what you are after I think.  It works with IE, Firefox and standard application dialogs too.
    I was previously employed by Lenovo but have no formal role on this forum.
    I am here on my own time because I like fooling with PCs, especially Lenovo ones. ALL my posts are purely my personal opinion.

  • I cracked my screen. I want to use other monitor which I had one. I bought Apple Mini-DP to VGA adapter. It worked. It means I can see ADDITIONAL screen. However I want to use this monitor for the main screen. How can I do?? Please help.

    I cracked my screen. I want to use other monitor which I had one. I bought an Apple Mini-DP to VGA adapter. It worked. It means I can see ADDITIONAL screen. However I want to use this monitor for the main screen. How can I do?? Please help.

    You have the display set in Extended Desktop mode. The Menu Bar and Dock will be on the MacBook display and your background screen on the monitor. In System Preferences>Display on the MacBook screen there should be an Arrangement tab when you have the MacBook hooked up to the monitor and both screens working. When you click the Arrangement tab do you see two monitors side by side? One of them will have a Menu Bar at the top. Just click on the Menu Bar and drag it to the second monitor. That will make the second monitor your main screen. You can now use your MacBook in Clamshell Mode with a wired or Bluetooth keyboard and mouse.  http://support.apple.com/kb/HT3131 When you disconnect from the monitor your Menu Bar will automatically change back to the MacBook.

  • Pls help me my ipod nano wont charge even if i use other laptop or pc . The battery notification tells its full charge but when i remove my ipod its still not charged

    Pls help me my ipod nano wont charge even if i use other laptop or pc . The battery notification tells its full charge but when i remove my ipod its still not charged

    Is it not charging at all? Did you try to reset? If YES to both, request for a replacement of the ipod. Battery or the unit itself is defective. Cheers!

  • Why would my Ipod Classic 160 GB (Late 2009) have remaining 224 MB or 0.20 GB of Used "Other" Capacity when everything else was restored to default as I intended?

    I'm running the latest version of Itunes 10.3.1.55. I have updated the most recent update of Ipod software 2.0.4 PC. After a recent OS crash on a different PC running Vista I lost all files so upon this installation of Itunes I performed Restore to accept my loss of media and start a new library on this Windows XP SP3 PC. Upon restoring to factory settings, Itunes, and my ipod in the about menu say I have 224 MB of Used "Other" Capacity. This reads as 0.20GB on Itunes. I have 0 songs, 0 photos, 0 videos, 0 podcasts, 0 iTunesU, 0 Contacts, 0 notes, and the 3 default games which I assume are apart from the total capacity as they were the first time I plugged my Ipod in. The 0.20GB is part of my total available capacity taking it from 148.79 to 148.5 or so. I have restored 3 times, the first of which was when all my Ipod contained was 5.1 gigs of unknown to myself "Other" files. which it diminished to the 0.20 I am at now. I am confused as to why Restoring would eliminate all except whatever is left that I can't identify, when it cleared everything else that I intended it to. Any Ideas would be appreciated. This is not Urgent as I'm currently importing albums and expect them to sync correctly, and the used space is not significant, but I am confused as I've explored the disk in windows, and seemingly all but manually formatted the drive. It may even change after I sync for the first time again so I hope I haven't spoke too soon. If that is the case I will post when that time comes. Haven't seen this situation on the forums or on google search. If you want to take this task on, Good Luck!

    my summary tab shows the total capacity of my ipod as 74.31 GB's with only 5 GB's of music and other on the ipod. What is taking up the other space? It should be showing a total capacity of 80 BG with 75 GB's left. What's up? Any body know?
    All hard drives never have the full advertised storage space, and as a general rule it's around 7% less than stated.
    It's because hard drive manufacturers calculate hard drive space different than computers actually read it.
    For a full technical explanation, see these.
    Hard disk: Is it missing space?
    How much content will fit on my iPod?

  • ITunes Match has stopped uploading - every file errors and says waiting - I have tried to delete the files and use other formats etc.  I have had the service since Day 1 and NEVER had an issue.  It didn't start until the Delete from Cloud switch to Hide

    iTunes Match has stopped uploading - every file errors and says waiting - I have tried to delete the files and use other formats etc.  I have had the service since Day 1 and NEVER had an issue.  It didn't start until the Delete from Cloud switch to Hide from cloud - the files that do not upload show grayed out on my other devices.

    Have you confirmed that you successfull purged iTunes Match by also looking on an iOS device?  If so, keep in mind that Apple's servers may be experiencing a heavy load right now.  They just added about 19 countries to the service and I've read a few accounts this morning that suggests all's not running perfectly right now.

  • How to download itunes for windows  7 64 bit using other system which is running 32 bit

    hi
    i am trying to download itunes 64 bit for my system using other system which is running 32 bit

    Direct links to the installers:
    iTunes 12.1.2.27  (64-bit) - iTunes6464Setup.exe
    iTunes 12.1.2.27 (64-bit "for older video cards") - itunes64setup.exe
    The second of these - which is actually the 32-bit application with a 64-bit installer - should be used if you get a warning about video card incompatibility when you install the standard 64-bit version, but also may resolve issues with playback, QuickTime integration, and problems with third-party applications (including Outlook).

  • Can I use Other database as the repository, Sybase/SQL Server? Urgent!!!

    Hi all,
    Can I use Other database as the repository, Sybase/SQL Server? Urgent!!!
    And Can I use other database store business data and sync with lite?
    Thanks ahead!!!

    Jonathan,
    No, it is not possible to use any other database than Oracle (8.1.7) or later .
    Oracle Lite will only work with Oracle.
    Regards

  • Using other software other than i tunes?

    Can i use other software other than itunes?. If so ,do i need to use the updator before connecting and synching with other software such as windows media player?.

    Yes, you can. But Windows Media Player cannot be used.
    Some of the programs you can use are:
    (1) Winamp (with iPod plugin)
    (2) Xplay
    (3) Anapod
    Note that these are 3rd party programs which are not supported by Apple. If you elect to use them, you will have to ask the software developers for support.
    By the way, why do you want to use another software rather than iTunes?

Maybe you are looking for