Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maherp1 opened this issue May 27, 2024 · 0 comments
Open

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

maherp1 opened this issue May 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@maherp1
Copy link

maherp1 commented May 27, 2024

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
@maherp1 maherp1 added the bug Something isn't working label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant