Hi,
this my problem: I have a object with text templates: id, name and byte[] in BLOB. The templates are used in several other objects. My need is to know whether the template is used by other objects. Is it possible to bind a not persistent field with JPQL/HQL query, which check a occurrence of the template? Use case, e.g., if the template is used, the delete operation of template is prohibited.
E.g.
@Entity(name = "TEMPLATE") public class Template {
@Id private long id;
@Column(name = "NAME") private String name;
@Lob @Column(name = "TEXT") private byte[] text;
@not-know-annotation(query = "SELECT... which returns number of the occurrence of the template") private long counter;
... simple setters and getters... }
and later in a other code:
if (template.getCounter > 0) { disableDelete(); }
Is it possible?
Regards, Jacek
|