Guest User

Untitled

a guest
Jan 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @Entity
  2. @Inheritance(strategy = InheritanceType.JOINED)
  3. @DiscriminatorColumn(name = "resourceType", discriminatorType = DiscriminatorType.INTEGER)
  4. public abstract class Resource {
  5. @Id
  6. @GeneratedValue(strategy = GenerationType.TABLE)
  7. Long id;
  8.  
  9. String foo;
  10. }
  11.  
  12.  
  13. @MappedSuperclass
  14. public abstract class NetworkResource extends Resource {
  15. String bar;
  16. }
  17.  
  18. @Entity
  19. @DiscriminatorValue(value = "1")
  20. public class URL extends NetworkResource {
  21. String url;
  22. }
  23.  
  24. SELECT c FROM URL c LEFT JOIN c.resource r where r.resourceType = 1 and r.url = :ip
  25.  
  26. select c from URL c where c.url = :ip
Add Comment
Please, Sign In to add comment