Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity //ОСНОВНАЯ сущность
- @Table(name = "data_collection")
- public class DataCollectionEntity {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "data_collection_gen")
- @SequenceGenerator(name = "data_collection_gen", sequenceName = "data_collection_sequence", allocationSize = 1)
- private Long id;
- @Enumerated(EnumType.STRING)
- private DataCollectionType type;
- @Column(insertable = false)
- private Date modifiedOn;
- @OneToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "template_id", referencedColumnName = "id")
- private TemplateEntity template;
- @OneToMany(
- mappedBy = "data_collection",
- cascade = CascadeType.ALL,
- orphanRemoval = true
- )
- @OrderBy("date DESC")
- private Collection<DataCollectionLogEntity> dataCollectionLog;
- //логи основной сущности
- @Entity
- @Table(name = "data_collection")
- public class DataCollectionEntity {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "data_collection_gen")
- @SequenceGenerator(name = "data_collection_gen", sequenceName = "data_collection_sequence", allocationSize = 1)
- private Long id;
- private String name;
- private byte[] data;
- private String fileName;
- private String description;
- @Enumerated(EnumType.STRING)
- private DataCollectionType type;
- @Column(insertable = false)
- private Date modifiedOn;
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = " author_id")
- private UserEntity author;
- @OneToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "template_id", referencedColumnName = "id")
- private TemplateEntity template;
- @OneToMany(
- mappedBy = "data_collection",
- cascade = CascadeType.ALL,
- orphanRemoval = true
- )
- @OrderBy("date DESC")
- private Collection<DataCollectionLogEntity> dataCollectionLog;
Advertisement
Add Comment
Please, Sign In to add comment