Skip to content

Show better error message when Model class isn't abstract #56

@maherp1

Description

@maherp1

Describe the Bug
When you extend the ORM Model to your own Model and forget to set it to abstract, you get an Exception saying

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Field.getType()" because the return value of "org.javawebstack.orm.TableInfo.getField(String)" is null
	at org.javawebstack.orm.TableInfo.getIdType(TableInfo.java:282)
	at org.javawebstack.orm.TableInfo.analyzeTable(TableInfo.java:95)
	at org.javawebstack.orm.TableInfo.constructInfo(TableInfo.java:61)
	at org.javawebstack.orm.TableInfo.<init>(TableInfo.java:56)
	at org.javawebstack.orm.Repo.<init>(Repo.java:35)
	at org.javawebstack.orm.ORM.register(ORM.java:25)
	at org.javawebstack.orm.ORM.register(ORM.java:37)

To Reproduce
Steps to reproduce the behavior:

  1. Forget to set your model class to abstract

Expected behavior
Maybe show some better error message which indicates that your base model isn't abstract yet.

Environment Information:

  • Java Language Level 21
  • ORM Version 1.0.3-SNAPSHOT

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions