In my computer, I get this code works.It's a little different from Daimon's answer.
@SqlResultSetMapping(_x000D_
name="groupDetailsMapping",_x000D_
classes={_x000D_
@ConstructorResult(_x000D_
targetClass=GroupDetails.class,_x000D_
columns={_x000D_
@ColumnResult(name="GROUP_ID",type=Integer.class),_x000D_
@ColumnResult(name="USER_ID",type=Integer.class)_x000D_
}_x000D_
)_x000D_
}_x000D_
)_x000D_
_x000D_
@NamedNativeQuery(name="User.getGroupDetails", query="SELECT g.*, gm.* FROM group g LEFT JOIN group_members gm ON g.group_id = gm.group_id and gm.user_id = :userId WHERE g.group_id = :groupId", resultSetMapping="groupDetailsMapping")
_x000D_