aileftech / snap-admin

A plug-and-play, auto-generated CRUD database admin panel for Spring Boot apps
MIT License
251 stars 18 forks source link

Generated query for console is commented that leads to NO #39

Closed ivan-shevtsov closed 3 months ago

ivan-shevtsov commented 10 months ago

Empty spring boot 3.1.5 application with -web and -data-jpa starters. Database: postgresql Snapadmin: 0.2.0

after launching I can see entity has been scanned and available at /admin. but Console does not work, since thrown exception 'org.postgresql.util.PSQLException' is not translated to TransientDataAccessResourceException.

I was able to address the issue by putting https://github.com/spring-projects/spring-framework/blob/main/spring-jdbc/src/main/resources/org/springframework/jdbc/support/sql-error-codes.xml with

        <property name="transientDataAccessResourceCodes">
            <value>02000</value>
        </property>

but, maybe it make sense not to fall on initial (generated) sql... or at least somehow to show error on UI.

aileftech commented 9 months ago

Hi and thanks for reporting this!

If I understand this correctly this is just for the initial generated query that is commented out (and does not generate results). The console should work if you enter an actual query without comments, right? Just want to clarify this since you said that the "Console does not work".

However, I will now start testing with PSQL and change the handling of errors in order to avoid this problem.

ivan-shevtsov commented 9 months ago

@aileftech that is correct. Since jdbc driver has not got any data, it throw PSQLException and server responded with httpStatus=500. As a result, instead of Console I got a default tomcat error page

aileftech commented 9 months ago

This should be fixed with the latest commit on the dev branch.