apache / apache/grails-core

ability to disable GORM methods on domain class

Open
#14,549 1 comment 1 reaction 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Steps to Reproduce

1. Create a domain class
2. Create data service for given data class
3. You can use both GORM methods and GORM data services

### Expected Behaviour

To emphasize using GORM data services once the service was created there should be way how to disallow using the GORM data method in the application. Instead of plain boolean value, I would prefer having an enum for "soft disallow". The settings should ideally take place as a value of `@Entity` annotation.

```
@Entity(gormMethods = GormMethodsUsage.PRESENT) // default, current behaviour
@Entity(gormMethods = GormMethodsUsage.WARN) // using the method will log a warning on runtime and ideally also during compile time
@Entity(gormMethods = GormMethodsUsage.ERROR) // using the method will log an error on runtime and ideally also during compile time
@Entity(gormMethods = GormMethodsUsage.NOT_PRESENT) // the GORM methods are not present at all, this is an option for brand new projects
```

### Actual Behaviour
GORM methods are always present.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how @Entity domain classes expose GORM methods and how GORM data services are generated. Define the behavior for PRESENT, WARN, ERROR, and NOT_PRESENT, including runtime and compile-time handling, then verify that the selected setting is honored when a data service exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.