Add Image Column in Broadleaf Admin Custom Entities

80 Views Asked by At

I added below mentioned custom entity for insert image from broadleaf admin console. But that image field not appear in the admin console. I added 'MEDIA' filed in my entity class. Please help me to solve this issue.

@Entity
@Table(name="MY_CUSTOM_CLASS")
@Inheritance(strategy = InheritanceType.JOINED)
@AdminPresentationClass(friendlyName = "MyCustomClass")

public class MyCustomClass implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "MyCustomClassId")
    @GenericGenerator(
            name="MyCustomClassId",
            strategy="org.broadleafcommerce.common.persistence.IdOverrideTableGenerator",
            parameters = {
                    @Parameter(name="segment_value", value="MyCustomClass"),
                    @Parameter(name="entity_name", value="com.community.core.domain.MyCustomClass")
            }
    )
    @Column(name = "MY_CUSTOM_CLASS_ID")
    protected Long id;

    @Column(name = "NAME", nullable = false)
    @AdminPresentation(friendlyName = "MyCustomClass_name", order = 1,
            prominent = true, gridOrder = 1)
    protected String name;

    @ManyToOne(targetEntity = MediaImpl.class, cascade = {CascadeType.ALL})
    @JoinColumn(name = "MEDIA_ID")
    @ClonePolicy
    protected Media media;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Media getMedia() {
        return media;
    }

    public void setMedia(Media media) {
        this.media = media;
    }

}

Any help or workarounds are really appricated.

1

There are 1 best solutions below

0
mouse_8b On

Put an @AdminPresentation annotation on the media field.