java - Error while Inserting into many to many relationship using hibernate -


I am attempting to insert several in many relationships using hibernate, but I am getting this error .

2014-04-24 14: 50: 47820 Error [BasicPropertyAccessor.java:118]: IllegalArgumentException in the classroom: Property Setter Method of com.jellboi.maniartyre.entities.AbstractEntity ,: pkey < / p>

Error 0 -4-24 14: 50: 47827 [BasicPropertyEzor. Java: 2222]: Expected type: java.lang.Long, actual value: org.hibernate.id.IdentifierGeneratorHelper $ 2

April 24, 2014 2: 55: 25 PM CALL CALL ORG.apache.catalina.core .standardWrapperValve: Servlet.service () Throwed exception for the servlet applicationController java.lang.IllegalArgumentException: sun.reflect.GeneratedMethodAccessor27.invoke at java.lang.ClassCastException@17d66f6 (unknown sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 25) java.lang.reflect.Method.invoke at (Method.java597)

here is the source) code that i am tr ying. VehicleProduct class

  @Entity @Table (name = "m_vehicle_product") @AssociationOverrides ({@AssociationOverride (name = "pk.vehicle", joinColumns = @JoinColumn ( Name = "vehicle_id"), @Association Override (name = "PK Product", join column = @Joint column (name = "product_id"))}} public class vehicle product essence {private string service; Private vehicle ProductID PK = new vehicle ProductID (); @column (name = "service") public string getService () {return service;} Public zero Service (string service) {this.service = service;} @ embedded id public vehicle product id obtained (pk) {return pk;} public zero set pk (VehicleProductId pk) {this.pk = pk;} @transcent public product GetProduct ();} GetProduct ();} Public Zero Set Product (Product Product) {getPk (.) SetProduct (Product);} @ Transaction Public Vehicle Millowel () {getPk (). GetVehicle ( );} Public Zero Set Vehicle (Vehicle Vehicles) {getPk (.) SetVehicle (Vehicle); }}   

Vehicle Product ID Class

  @ Embedded Public Class Vehicle ProductID applies java.io.Serializable {Personal Vehicle vehicle; Personal product product; @ManyToOne public vehicle getVehicle () {return vehicle; } Public Zero Set Vehicle (Vehicle Vehicle) {this.vehicle = Vehicle; } @ManyToOne public product getProduct () {return product; } Public Zero Set Product (Product Product) {this.product = Product; }}   

And this is how I am inserting.

 for  (int i = 0; i & lt; jobid.length; i ++) {product = productService .findByPkey (jobid [i]); VehicleProduct.setProduct (product); vehicleProduct.setService (jobdesc [i]); Pkey2 = Vehicle Manufacturer Service. (Vehicle product); }   

Please guide me on this. Trying to solve this problem for hours.

  @MappedSuperclass implements Public Class Abreactivity IERTTI, serializable {Private Static Finals Long Serial VisserionUID = 1 L; Private long cookie; Personal Boolean Removal; Private string maker; Made a personal date; Private string converter; The personal date changed; Private long version; @Id @ Generated Values ​​@column (name = "pakki") public long milling () {return pakie; } Public Zero Setpack (Long Paky) {this.pkey = pkey; } @column (name = "deleted") @ XML transgent public boolean received (deleted) {deleted; } Public Zero Set Removed (Boolean Deleted) {this.deleted = deleted; } @column (name = "creator") public string getCreator () {return creator; }} ........   

This includes all the missing and the setters.

Your main problem is:

2014-04-24 14: 50: 47,820 error [Basic Property Evester. Java 18]: Exception in Invalid Record Category: Com. Jellboi.maniartyre.entities.AbstractEntity, Setter Method of Property: pkey

2014-04-24 14: 50: 47827 Error [Basic PropertyAccessor.java:1222]: Expected Type: java.lang.Long, Actual Value: org.hibernate.id.IdentifierGeneratorHelper $ 2

If you see your code, then you have a @ id defined on your abstract element And an @ embedded id on your vehicle product

I'm not sure how your database table looks, but it contains columns in AbrixTNT and with Only those forms defined in vehicle product will be included. If the column is not the meaning, then you should not take the heir to the abrasione. If they are there, consider making a @ embedded ID in an @ embedded and apply a unique obligation for the business key.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -