Posts

Showing posts with the label hibernate

Wait_timeout in a tomcat app

Image
Clash Royale CLAN TAG #URR8PPP Wait_timeout in a tomcat app I'm building an app in a tomcat server (JSP+Servlet+Hibernate(MYSQL)), but when I test this app, when have passed 24 hrs, I recieve this error. The last packet successfully received from the server was 59,480,937 milliseconds ago. The last packet sent successfully to the server was 59,480,937 milliseconds ago. is longer than the server configured value of 'wait_timeout'. How can I solve it? Should add I wait_timeout on hibernate conf file? Should change I something on my DB? Thanks :) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

how to update domain with hql that has nested property?

Image
Clash Royale CLAN TAG #URR8PPP how to update domain with hql that has nested property? I have RaceRegistration class that has a property of type Participant which has attribute bibNumber. I would like to set all bibNumbers belonging to an event to null. The following hql doesn's work. It is giving the error. So it looks like it cannot recognize r.participant.bibNumber. node to traverse cannot be null!. Stacktrace follows: java.lang.IllegalArgumentException: node to traverse cannot be null! How can i update nested attribute of a domain class? RaceRegistration.executeUpdate("update RaceRegistration r set r.participant.bibNumber = null" + "where compositeEvent=:comp", [comp: compositeEvent ]) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subjec...

java.lang.IllegalStateException: No primary constructor found for java.util.List

Image
Clash Royale CLAN TAG #URR8PPP java.lang.IllegalStateException: No primary constructor found for java.util.List My project based on spring boot,Thymeleaf,mysql,html and Jquery. I tried to post a List of EntSetCharges type data to the @controller ,but it is not succeed..it trows error like java.lang.IllegalStateException: No primary constructor found for java.util.List Previously i worked with this error org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'chargesName' cannot be found on null Now i got another error in same page Here is my full code... <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> <!-- bootstrap css lib --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> </head> <body> <!-- Bootstrap...

why select query in hibernate returning null value

Image
Clash Royale CLAN TAG #URR8PPP why select query in hibernate returning null value executing these hql... and returning null but in client server i can see output in mysql. Hibernate: alter table Product add constraint FKj4jgrmm2hxt9q00jqrvipjqoa foreign key (buyer_buyerId) references Buyer (buyerId) Hibernate: alter table Product add constraint FK4d4c781mh5deww0h3ukw66eu6 foreign key (seller_sellerId) references Seller (sellerId) Hibernate: select product0_.productId as productI1_1_, product0_.buyer_buyerId as buyer_bu7_1_, product0_.currentStockNumbers as currentS2_1_, product0_.price as price3_1_, product0_.productCategory as productC4_1_, product0_.productName as productN5_1_, product0_.remarks as remarks6_1_, product0_.seller_sellerId as seller_s8_1_ from Product product0_ where product0_.productCategory like 'mobile' Hibernate: select seller0_.sellerId as sellerId1_2_0_, seller0_.sellerName as sellerNa2_2_0_ from Seller seller0_ where seller0_.sellerId=? Hibernate: select ...

Using sum in hibernate criteria

Image
Clash Royale CLAN TAG #URR8PPP Using sum in hibernate criteria How can I express this query in hibernate criteria?? select SUM (tabla2.valor1) from tabla1 INNER JOIN tabla2 ON tabla1.ID = tabla2.ID where tabla1.ID = 1 Thanks! By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How to use one to one/zero mapping in hibernate

Image
Clash Royale CLAN TAG #URR8PPP How to use one to one/zero mapping in hibernate Suppose I have two tables: Person And Vehicle Person record can exist independently , that means, a person may or may not associated with a vehicle. But the Vehicle record can not exist without person. In the nutshell, Vehicle table has Person_Id has foreign key, where Person_Id is the primary key of the person table. Now to define this relationship in hibernate I have used one to one mapping as follows: public class Person { private int person_id; @OnetoOne(mappedBy = "person", cascade = CascadeType.ALL) private Vehicle vehicle; } public class Vehicle { private int vehicle_id; @OnetoOne(fetch = FetchType.LAZY) @JoinColumn(name = "person_id") private Person person; } Now, when I try to save the Person who has Vehicle, the person objects gets saved successfully. I just use session.save(person) and both the objects gets saved successfully. On the other hand, ...

Why @Embeddable and @Embedded provided by Hibernate

Image
Clash Royale CLAN TAG #URR8PPP Why @Embeddable and @Embedded provided by Hibernate Have Entity objects properly defined. Able to save data successfully. @Embeddable public class Address { private Integer houseNo; private String streetName; private String state, country; } @Entity public class College { @Id @GeneratedValue private Integer collegeId; private String cName; @Embedded Address address; } But, When I use @Embeddable and @Embedded in hibernate application the final result looks like below. mysql> select * from college; +-----------+---------+---------+----------+--------------+-------+ | collegeId | country | houseNo | state | streetName | cName | +-----------+---------+---------+----------+--------------+-------+ | 1 | Makkah | 121 | Al-Azeed | Bilaal Stree | SMust | +-----------+---------+---------+----------+--------------+-------+ My doubt is if Address fields have been saved in same table why we are using @Embeddabl...

More problems with JPA deletion of row in database

More problems with JPA deletion of row in database I have the following code that defines the relationship between three tables. public class Attachment implements Serializable { @Id @Column(name="attachment_id") private int attachmentId; @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="reference_id") private Reference reference; @OneToMany(mappedBy="attachment") private List<Reference> references; MORE STUFF; } public class Uuid implements Serializable { @Id @Column("name=uuid_id") @GeneratedValue(strategy=GenerationType.IDENTITY) private int uuidId; @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="reference_id") private Reference reference; MORE STUFF } public class Reference implements Serializable { @Id @Column(name="reference_id") @GeneratedValue(strategy=GenerationType.IDENTITY) private int referenceId; @OneToMany(mappedBy="reference") private List<Attachment> attachments; ...