Coder Social home page Coder Social logo

Comments (10)

darrachequesne avatar darrachequesne commented on August 28, 2024

Hi! I'm afraid I'll need a bit more context to debug that 👼

Did you follow the instructions here? More specifically that line:

@EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class)

Could you share your Benefit (and BenefitRepository) classes please?

from spring-data-jpa-datatables-sample.

alesisjoan avatar alesisjoan commented on August 28, 2024

OK, inserting @EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class) to the WebAppConfig.java solved my issue.

You can close the issue, but now i have anoter error.

With Ajax call not matching the controller method.

Here is my Controller:

@Controller
@RequestMapping(value = "/Benefit")
public class BenefitController {

    @Autowired
    BenefitDataTableRepo benefitDataTableRepo;

    @JsonView(DataTablesOutput.View.class)
    @RequestMapping(value = "/datatable2", method = RequestMethod.GET)
    public @ResponseBody DataTablesOutput<Benefit> getBenefits2(@Valid DataTablesInput input){
        return benefitDataTableRepo.findAll(input);
    }

}

here is my repo:

public interface BenefitDataTableRepo extends DataTablesRepository<Benefit, Long> {
}

here is js function:

        var table = $('#table_benefits').DataTable({
                                                       'ajax' : '/datatable2',
                                                       'serverSide' : true,
                                                       columns : [ {
                                                           data : 'benefitOid'
                                                       }, {
                                                           data : 'parameter'
                                                       }, {
                                                           data : 'type'
                                                       }, {
                                                           data : 'checked'
                                                       } ]
                                                   });
    });

here is my entity:

@Entity
public class Benefit {

  @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long benefitOid;

    @NotNull
    private String parameter;

    private boolean checked = false;

}

from spring-data-jpa-datatables-sample.

darrachequesne avatar darrachequesne commented on August 28, 2024

I see you have two @RequestMapping. Shouldn't the url be /Benefit/datatable2 then?

from spring-data-jpa-datatables-sample.

alesisjoan avatar alesisjoan commented on August 28, 2024

I see you have two @RequestMapping. Shouldn't the url be /Benefit/datatable2 then?
Yep, i realized that after my comment was sent

Url changed to /Benefit/datatable2 but still not working.

from spring-data-jpa-datatables-sample.

darrachequesne avatar darrachequesne commented on August 28, 2024

@alesisjoan did you solve your issue? can you debug the request in devtools?

from spring-data-jpa-datatables-sample.

darrachequesne avatar darrachequesne commented on August 28, 2024

Closing, please reopen if needed.

from spring-data-jpa-datatables-sample.

tshavkat avatar tshavkat commented on August 28, 2024

Hi! I'm afraid I'll need a bit more context to debug that 👼

Did you follow the instructions here? More specifically that line:

@EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class)

Could you share your Benefit (and BenefitRepository) classes please?

Very usefull, thanks very much!

from spring-data-jpa-datatables-sample.

anuragdhiman avatar anuragdhiman commented on August 28, 2024

Hi there,
Facing the same issue, please help me out,
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customreProfileRepo': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property findAll found for type DataTablesOutput!

Below is my code

  1. This is my separate configuration class because I have an already existing class which is invoking base package
@Configuration
@EnableMongoRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class, 
			basePackages = { "com.base.repo.customer" })
public class DataTableConfig {

}

  1. A repo class
@Repository
public interface CustomerProfileRepo extends DataTablesRepository<CustomerProfile, String>{

}
  1. Controller class
@RequestMapping(value ="/customer/list", method = RequestMethod.GET)
	    public DataTablesOutput<CustomerProfile> list(@Valid DataTablesInput input) {
	        return customerProfileRepo.findAll(input);
	    }

from spring-data-jpa-datatables-sample.

darrachequesne avatar darrachequesne commented on August 28, 2024

@anuragdhiman Hi! Would you be able to reproduce your issue by forking this repo? If you are actually able to reproduce, could you please open a new issue with all necessary details? Thanks!

from spring-data-jpa-datatables-sample.

anuragdhiman avatar anuragdhiman commented on August 28, 2024

@darrachequesne Thanks for sharing this. Sure I will try the same and get back!

from spring-data-jpa-datatables-sample.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.