Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. @Data
  2. @Entity(name= "mv_garage_asset_mapping")
  3. public class GarageAssetMapping implements Serializable {
  4.  
  5. /**
  6. *
  7. */
  8. private static final long serialVersionUID = 2535545189473989744L;
  9.  
  10. @Id
  11. @Column(name="GARAGE_CODE")
  12. private String garageCode;
  13.  
  14. @Column(name="CONTRACT_NUMBER")
  15. private String contractNumber;
  16.  
  17. @OneToOne( fetch=FetchType.LAZY )
  18. @JoinColumn(name="CONTRACT_NUMBER", referencedColumnName = "hpano", insertable = false, updatable = false)
  19. @NotFound(action = NotFoundAction.IGNORE)
  20. private RepoAgentDetails repoAgentDetails;
  21. }
  22.  
  23. @Entity
  24. public class RepoAgentDetails {
  25. @Column(name="hpano")
  26. private String hpano;
  27. @OneToOne(mappedBy = "repoAgentDetails", fetch = FetchType.LAZY)
  28. private GarageAssetMapping garageAssetMapping;
  29. }
  30.  
  31. @Query("select new com.mf.acrs.garage.bean.AssetDetailsBean (ga.contractNumber as contractNumber, ra.create_date as createDate ) "
  32. + "from mv_garage_asset_mapping ga "
  33. + " inner join RepoAgentDetails ra on ga.contractNumber = ra.hpano"
  34. + " where ga.garageCode = ?1 ")
  35.  
  36.  
  37. List<AssetDetailsBean> findByGarageCode ( String garageCode );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement