I have 2 entities as batch & batchDetailEntity. I try to insert records to my database postgresql using spring boot reactor r2dbcEntityTemplate.insert() & I am getting error like Nested entities are not supported.
My code
Error
Instead of insert(Mono.just(batchDetailEntity))
put insert(batchDetailEntity) It may work for you.
Related
I am using PostgreSQL database with Hibernate and Spring Rest.
I am getting sorted data in Hibernate Criteria from Postman but when data is sorted on descending order the NULL values come first, I believe this may be how PostgreSQL is sending data to Hibernate.
I know in Hibernate 4.2.x and 4.3.x there are ways to implement this using Order as shown below
Criteria criteria = ...;
criteria.addOrder( Order.desc( "name" ).nulls(NullPrecedence.LAST) );
But there is no similar implementation in 3.6 as I was getting compilation when I tried the same.
From Hibernate order by with nulls last I tried setting the Hibernate properties:
hibernate.order_by.default_null_ordering=last
It did not help me.
I am setting it as Hibernate configuration parameter, but it's not working.
I have to modify legacy code which is using Criteria so how can I implement NULLs ordering while using Criteria in Hibernate 3.6?
I recently upgraded Spring Boot and with this came a hibernate upgrade. Unfortunately, the entity column #Type(StringClobType) annotation has been deprecated. The documentation tell me I need to switch it to MaterilizedClobType.
Unfortunately this has broken my application.
I'm using PostgreSQL 9.5. The StringClobType annotation created a text type in the database which allowed me to store long text in the field. Unfortunately now, the string literal comes back when Hibernate is expecting some kind of LOB id.
This gives the error: Bad value for type long
The Hibernate #Type value that maps to PG's Text data type is org.hibernate.type.TextType. This is what you should use.
For what it's worth, this a sibling of org.hibernate.type.MaterializedClobType, which maps to CLOB; both are subclasses of org.hibernate.type.AbstractLongStringType.
I have several database tables that my Spring MVC/JPA application refers to using the #Entity and #Table Annotations. I've run into the issue where if my application switches between database connections, some tables that exist on database 1 may not exist in database 2 (as we are following the SDLC cycle and promoting table additions/changes after they get the "OK"), thus resulting in an SQL Exception when the application server starts.
Does spring offer a way to mark specific #Entity Classes as "Optional" or "Transactional" so there are no database Exceptions returned because of nonexistant tables?
In my opinion, there is no option to do that.
You can add automatic update of schema in Hibernate, but you mentioned that you are doing this manually.
Hibernate is validating the schema, when he establishes connection. You use #Entity, so he looks for that table and throws an error if there is no with the name specified.
I am trying to create a data access layer where an application would like to use both a traditional SQL store as well as a NoSQL store. After few searches, I have found a concept like Spring Data MongoDB cross strore and this concept similar to my requirement. So that, I have successfully configured as suggested in the reference document https://stackoverflow.com/a/13998825.
But I am getting below error when I test the above sample. Can some one please help in this regard...
Error: Caused by: org.hibernate.MappingException: Could not determine type for: com.hcc.riab.model.ProductInfo, at table: Product, for columns: [org.hibernate.mapping.Column(productInfo)]
I have a 25 .xsd schemas and want to generate DB tables and POJO classes from this schemas.
Hibernate can do it? Im already try generate DB tables with XMLSpy and POJO with JiBX, but when i generate mapping with Hibernate names of tables in DB and in mappings was different. I want to use single tool to do this.
UPDATE
I try generate POJO with hibernate. I create \hibernate.cfg.xml ,hibernate.reveng.xml and console config. And when i try run configuration get error
org.hibernate.MappingException: Could not configure overrides from file: D:\liferay-develop\workspace\JABX_test\src\hibernate.reveng.xml
Could not configure overrides from file: D:\liferay-develop\workspace\JABX_test\src\hibernate.reveng.xml
org.hibernate.MappingException: invalid override definition
invalid override definition
org.hibernate.MappingException: invalid override definition
invalid override definition
org.xml.sax.SAXParseException: The content of element type "hibernate-reverse-engineering" must match "(schema-selection*,type-mapping?,table-filter*,table*)".
The content of element type "hibernate-reverse-engineering" must match "(schema-selection*,type-mapping?,table-filter*,table*)".
When i use empty TableFilter in reverse enginering hibernate create POJO but only from deafult postgres tables.
what i doing wrong?
UPDATE 2
How i use this tutorial http://www.youtube.com/watch?v=tfZiKn5xhXk and get error
org.hibernate.exception.JDBCConnectionException: Getting database metadata
Getting database metadata
java.sql.SQLException: No suitable driver found for jdbc:postgresql:localhost:5632:postgis_test
No suitable driver found for jdbc:postgresql:localhost:5632:postgis_test
java.sql.SQLException: No suitable driver found for jdbc:postgresql:localhost:5632:postgis_test
No suitable driver found for jdbc:postgresql:localhost:5632:postgis_test
UPDATE 3
Okey. Im reinstal eclipse and get situation like in first UPDATE again. So i try generate POJO from DB and get only POJO from postgis tables: geography_columns and spatial_ref_sys. Hibernate cant work with PostGis?