java - JPA Error : Primary Key was detected to be NULL -


There is a type of geometry column by JPA. I have a problem in querying the MySQL table. There are polygons in it, Forms are the set of latitude and longitude. When executing to select from the nativequery table, I am having the following error

  exception description: line [ArrayRecord (= & gt; primary key of reading; polygon (102.642 9 44444444 2.9757087270706 , 102.642944444444 2.79805447470818, .... = & gt; 16.0 => 325,990 during execution of the query.] It was revealed to be impaired primary key should not include null  
< P> There is no table though with the primary key in the form of null. The line is a very large polygon with line coordinates, and it is not sure if the problem is due to this.

After the table column name and type

  geomarea - Geometry is the code in the riskvalue - Double ID - Integer (autoIncrement, Primary key)  

After reading my EJB table

 <.code> query query = Em.createNativeQuery (+ node.getLongitude () + "" + + node.getLa "select astext (geomarea) geomarea, riskvalue, earthquake id where id (geomarea, geomFromText ('point (in Includes "titude () +") ')) ", Earthquakerisk.class; GeomList.addAll (query.getResultList ());  

And here are how the regions are declared in the unit square

  Public square Earthquakerisk implies Serializable {Personal Stable last long serialVersionUID = 1L; @basic (optional = false) @notental@lob@column (name = "GOMieria") private byte [] GOMAIA; @column (name = "risk value") private double risk value; @Id @GeneratedValue (strategy = GenerationType.IDENTITY) @Basic (optional = false) @column (name = "id") private integer ID; A  

Any idea how to solve it?

After the text "itemprop =" text ">

I found the solution to the problem. Adding it here makes anyone useful to it.

By changing the EarthCockersk class from the query, and changing my list in the list. So the code working now is as follows.

  list & lt; Object [] & gt; Geolist = New Arrestist & lt; & Gt; (); Query query = em.createNativeQuery ("select astext geomarea, riskvalue, earthquakeRisk id where (geomarea, GeomFromText (include '+ node.getLongitude (+ +) +' point (" + + + node.getLatitude () + " ) ')) "); GeomList.addAll (query.getResultList ());  

Comments