Search code examples
javaspringjpalightadmin

Lightadmin and RepositoryNotFoundException while saving an entity


JPA entity class:

@Entity(name="job_configuration")
public class JobConfiguration extends AbstractEntity {
    String name;

    @Lob
    String value;

    @ManyToOne
    @JoinColumn(name="job_id")
    Job job;
}

Lightadmin administration class:

public class JobConfigurationAdministration 
    extends AdministrationConfiguration<JobConfiguration> {
}

and now while trying to update/add a JobConfiguration entry Lightadmin throws a Spring exception org.springframework.data.rest.repository.RepositoryNotFoundException:

RepositoryNotFoundException: No repository found for name job_configuration 

list and view works fine. Any clues?


Update: I know what is causing this behavior the following declaration inside Job:

@OneToMany(mappedBy="job", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
Set<JobConfiguration> jobConfigurations;

Solution

  • Ok, I have found the cause of this issue:

    @Entity(name="job_configuration")
    

    if this entity is persisted in the default table name i.d. JobConfiguration then this issue is gone. It looks as a bug in Lightadmin/Spring.

    The workaround is to change the above to:

    @Entity