Example of use for the Categorized interface of dynattr


I’m looking for an example of usage of the Categorized interface dynattr.

I want to implement dynamic attributes per entity type.

Thanks in advance

Create a new attribute to your entity and make it the association with Category entity:


Then add the Categorized to the entity class manually:

public class Customer implements Categorized { // add manually

// added by designer
    @JoinColumn(name = "CATEGORY_ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private Category category;

    public Category getCategory() {
        return category;

    public void setCategory(Category category) {
        this.category = category;
// ...
1 Like