gorme | Global Offensive Realtime Map Editor | Map library
kandi X-RAY | gorme Summary
kandi X-RAY | gorme Summary
Global Offensive Realtime Map Editor
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gorme
gorme Key Features
gorme Examples and Code Snippets
Community Discussions
Trending Discussions on gorme
QUESTION
I'm having trouble testing Grails 4 with multiple datasources configured.
Domain Class ...ANSWER
Answered 2021-Jun-11 at 00:00I listed each datasource explicitly, and that fixed the problem.
QUESTION
Due to Grails 3 migration to Grails 4 had to upgrade Hibernate 5.1.5 to the latest Hibernate 5.4.14 (including hibernate-entitymanager, hibernate-spatial, hibernate-ehcache, hibernate-core...).
JVM: OpenJDK 11
org.springframework.boot 2.1.12.RELEASE
Database: PostgreSQL 10.4 installed extension Postgis 2.4.
According to documentation hibernate dialect should be associated to
ANSWER
Answered 2020-Apr-23 at 10:15The problem is due to the use of the old, deprecated versio for JTS which use the com.vividsolutions
package names.
Recent versions of Hibernate no longer recognize com.vividsolutions.geom.Geometry
as a geometry type so fails to engage to proper (de)serialization functions.
The solution is to upgrade to JTS versions > 1.15
QUESTION
How can I enforce that all entity persistence operations in my Grails application happen via GORM data services, and never directly on my domain classes (e.g. the methods in GormEntityApi
and dynamic finders)?
Ideally the GormEntityApi
and dynamic finder methods would not be available on my domain classes at all, but I'd also accept a solution that neuters the methods by causing them all to throw e.g. an UnsupportedOperationException
.
I've done a bunch of internet searches, pored over the GORM documentation, and even dug around in the GORM code a bit, and I can't seem to find any information about this. Since data services provide all the same CRUD functionality as GormEntityApi
and dynamic finders, this seems like a reasonable thing to want to do. I feel like I must be missing something.
ANSWER
Answered 2020-Mar-30 at 14:51How can I enforce that all entity persistence operations in my Grails application happen via a GORM data services
There is no way to enforce that right now.
I've done a bunch of internet searches, pored over the GORM documentation, and even dug around in the GORM code a bit, and I can't seem to find any information about this.
We don't have support in the framework for doing that.
Since data services provide all the same CRUD functionality as GormEntityApi and dynamic finders, this seems like a reasonable thing to want to do. I feel like I must be missing something.
I don't think you are missing something. We have considered not adding the GormEntity
trait to domain classes by default, but right now that happens and we don't provide a mechanism for turning that off.
QUESTION
I come from Grails background and have recently started a project in Micronaut using GORM.
I have the following code:
...ANSWER
Answered 2018-Dec-07 at 12:04Thanks to the excellent article suggested, I was able to solve the problem.
The solution was decorate the books declaration in the Author class with the @JsonManagedReference annotation and decorate the author declaration in the Book class withe the @JsonBackReference annotation.
QUESTION
Having a really weird issue in Grails and MongoDB where in my production environment I get the following error.
...ANSWER
Answered 2018-Nov-23 at 22:40I had the same issue, and after two days of debugging finally found a workaround.
The problem was caused by the following:- There is a Grails utility class called
org.grails.datastore.mapping.reflect.FieldEntityAccess
, apparently used to access entities fields using reflection. That class has an inner class calledFieldEntityReflector
. Every time aFieldEntityAccess
instance is created, there is an instance ofFieldEntityReflector
created internally. All those instances are stored in a static map calledREFLECTORS
, whose keys are the entity names, apparently for performance reasons. - During bean initialization,
mongoDatastore
bean creates oneFieldEntityAccess
for each entity, passing aDocumentPersistentEntity
as constructor parameter. - In the same way,
grailsDomainClassMappingContext
bean, unaware ofmongoDatastore
creates its ownFieldEntityAccess
for each entity, passing downKeyValuePersistentEntity
as parameter. ThoseFieldEntityAccess
instances and their correspondingEntityReflectors
are unaware of mongo and therefore don't support mongo specific types likePoint
. - Given that the
REFLECTORS
map keys are entity names,EntityReflectors
created last for the same entity, override previously created reflectors, and are used by allEntityReflector
instances. - When
grailsDomainClassMappingContext
reflectors are created last, they are used when mongo tries to persist and entity and therefore throw an error.
grailsDomainClassMappingContext
bean is initialized after mongoDatastore
bean.
In development mode, UrlMappingsGrailsPlugin
plugin creates some beans used to allow url mappings reloading. Those beans trigger instantiation of grailsDomainClassMappingContext
bean before mongoDatastore
bean. As the mongo beans are created later, the error is not thrown. But, in production mode, those beans are not created, and mongoDatastore
is created before grailsDomainClassMappingContext
, therefore throwing the error.
- Force
grailsDomainClassMappingContext
bean instantiation beforemongoDatastore
: I was unable to do that after several attempts, maybe because of grails bean instantiation logic. - Force
UrlMappingsGrailsPlugin
instantiation even on production mode: I prefered not to go that way due to possible permformance implications. - Use the static method
clearReflectors
ofFieldEntityAccess
class to clear all the reflectors after system initialization:** I decided to do that and the system started to work. I haven't tested it in depth, but was able to persistPoint
correctly.
In order to call the method, I created a bean depending on both grailsDomainClassMappingContext
and mongoDatastore
and called FieldEntityAccess.clearReflectors()
QUESTION
is it required to do database migration for upgrading Grails 2.4.5 to 3.3.2 project. Currently, I m facing an issue in Bootstrap.groovy, application fails to start.
...ANSWER
Answered 2018-Feb-27 at 19:14Presumably you updated from Hibernate 4 to 5 at the same time? Hibernate 5 currently has an issue where it generates foreign keys differently: https://hibernate.atlassian.net/browse/HHH-10574
I'm not sure this is the issue you're seeing, but it might be related. Even if not, it's something to be aware of.
QUESTION
I'm working on a grails rest app. The grails version I'm using is 3.3.1. I'm using spring-security-rest for authorization. I've created the following classes using the s2-quickstart command.
- User
- Authority
- UserAuthority
The app runs fine but the unit tests for the User class fail with the following error in console.
...ANSWER
Answered 2018-Feb-24 at 11:14So normally in a Unit test you test a single unit, User
in this case. Because you want to test additional entities, you need to add them to the test. You can do this by implementing getDomainClassesToMock
. Best is to use the DataTest
trait instead of the DomainUnitTest
in this situation (DomainUnitTest
extends DataTest
).
So your test should look like:
QUESTION
I am trying use mock to the domains class but in findBy is not working, show that the class is null.
At last time give this error:
...ANSWER
Answered 2018-Jan-10 at 19:10For grails >= 3.3.0 you can mock domain classes using new Unit Test framework features. Implement DataTest and getDomainClassesToMock():
QUESTION
I am trying to create a POC for using GORM outside Grails. I created a groovy-gradle standalone plugin. I followed the official docs and
made a count()
query to my User domain in main()
class. While running the application using gradle run
command came across this error:
ANSWER
Answered 2017-Dec-24 at 02:56You are getting the error because nowhere in your code are you starting a Hibernate session. There are several ways you can address this. One is you can start a session explicitly...
QUESTION
I have to make a Grails 3.3.0 web interface for my internship with PostgreSQL version 10.1 as database and spring-security-core version 3.2.0.
I've installed PostgreSQL on my Linux laptop and created the webInterfaceDev database with the user Postgres.
However, every time I want to start the project I get the error "object references an unsaved transient instance".
This is the error that I get:
...ANSWER
Answered 2017-Nov-24 at 06:52Long story in short
Your User.findOrSaveWhere(username:"admin", password:"password")
is the problem. If you try without password:"password"
your code will run considering setting the password user.password='password'
while initiating new User
.
The saved password in the DB is hashed and it doesn't match with your given password. So, everytime you run the app, it doesn't find matching user and tries to save a new User with same username
violating the unique
constraints.
Deatils -
I tried with below codes -
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gorme
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page