Posts

Showing posts with the label jpa

JBWEB000236: Servlet.service(), maven, jboss, rest

JBWEB000236: Servlet.service(), maven, jboss, rest I try to recover data from a table but when I try to access the method where it gets the data from the database it gives me an error. Executing http://localhost:8080/cart/service/sepsRest/obtenerCatalogo; in the line http://localhost:8080/cart/service/sepsRest/obtenerCatalogo; listaCatalogo = catalogoServicio.obtenerPorGrupoNemonico("TIPOID"); It gives me the following error. 15:48:15,370 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cart].[javax.ws.rs.core.Application]] (http-/0.0.0.0:8080-6) JBWEB000236: Servlet.service() for servlet javax.ws.rs.core.Application threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:364) [resteasy-jaxrs-2.3.10.Final-redhat-1.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.ja...

JPA/Hibernate shared primary key and @OneToOne mapping

JPA/Hibernate shared primary key and @OneToOne mapping Is it possible,when using @OneToOne mapping and shared primary key to insert child object,while updating Parent object? public class Project{ @Id @SequenceGenerator(name = "projectsIdSeq", sequenceName = "PROJECTS_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "projectsIdSeq") private Long id; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "ID", referencedColumnName = "PROJECT_ID") @PrimaryKeyJoinColumn private PlanningStageInfo planningStageInfo; } public class PlanningStageInfo{ @Id @Column(name = "PROJECT_ID") private Long projectId; @NotAudited @JsonIgnore @MapsId @OneToOne(mappedBy = "planningStageInfo") private Project project; } When I'm trying to update Project without PlanningStageInfo I'm getting eroor Caused by: org.hibernate.id.IdentifierGenerationException: attempted to as...

How can I choose ideal way for pagination in Spring boot?

Image
How can I choose ideal way for pagination in Spring boot? I need your advice for paginations. My table data is very long.Therefor I use pagination and every pag action İ call data from database I have a rest method in spring-boot application. This method could get data from database and everthing is ok. I need pag count(all count of my data/ perPage count). I can find this count from db. I must write two seperate method for allCount and the below method? How can I use ideal way for pagination in Spring boot? @CrossOrigin(maxAge = 3600) @RequestMapping(value = "/payment/all", method = RequestMethod.POST) public List<NotaryPaymentInformationEntity> getAllProduct(@RequestBody PaginationModel pag){ try { System.out.println(pag.getPageno()+ " " + pag.getRecords()); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } Pageable pageable = new PageRequest(pag.getPage...