Map One Column of a Table with Hibernate Annotation
<p>I work on a private network so too difficult to copy and paste my code.  I have found a bunch of answers close to what I need but none have worked out.  I'll try to do a quick example of my code, hopefully good enough to decipher my problem.</p>

<pre><code>@Table(name="DRIVER")
class Driver {
    long id; //ID - primary key of Driver
    String driverIdentStr;  // DRIVER_IDENT_STR - like driver's license #
}//end class Driver

@Table(name="GROUP_PARTICIPANT")
class GroupParticipant {
    long id; //ID - primary key of GroupParticipant
    long driverId; //DRIVER_ID - id of the Driver participanting and maps to Driver.id

    //I just want this one value from Driver and not the whole Driver...
    //I've tried:
    //@Formula("(select driverIdentStr from Driver where Driver.id = DRIVER_ID)")
    //also tried:
    //@Column(table="DRIVER", name="driverIdentStr")
    String driverIdentStr;  
}//end class GroupParticipant
</code></pre>

<p>The @Formula failed with "table or view not found" but i definitely have a Driver class defined mapping to DRIVER table.  When I changed the query language in the @Formula to be SQL instead of HQL Hibernate complains that GROUPPARTICIPANT0.driverIdentStr is an invalid identifier - think it was trying to retrieve driverIdentStr from GroupParticipant instead of getting the value from Driver (??).</p>

<p>The @Column fails, i think, because i'm not sure how to map to DRIVER from the driverId I have in GroupParticipant.</p>

<p>Bottom line, i can't figure out how to get GroupParticipant.driverIdentStr to be pulled from joining GroupParticipant.driverId on Driver.id and getting Driver.driverIdentStr.</p>

<p>Any help would be greatly appreciated.</p>