This may be related to the settings Editor > Code Style > Java Editor > Code Style > Java 在Arrangement标签下可以自由设置属性和方法的排序规则You can freely set the sorting rules for properties and methods under the Arrangement tag
You may need to reformat before sorting. Try it yourself. The screenshot below is part of my settings
Are you using the hibernate entity generation class that comes with idea? This generation seems to be like this, but if you use idea's getter/setter generation, it is impossible to do this. This will only happen if you export entity classes from the database
This may be related to the settings
Editor > Code Style > Java
Editor > Code Style > Java
在Arrangement标签下可以自由设置属性和方法的排序规则
You can freely set the sorting rules for properties and methods under the Arrangement tag
You may need to reformat before sorting. Try it yourself. The screenshot below is part of my settings

Are you using the hibernate entity generation class that comes with idea? This generation seems to be like this, but if you use idea's getter/setter generation, it is impossible to do this. This will only happen if you export entity classes from the database