Issue in editing the DataObject managed in the ModelAdmin

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

My project is using Silverstripe version 4.5
It has a Standalone DataObject management ModelAdmin section. It was working well on Silverstripe v3 but after upgrading to v4.5 its not working. On clicking on any of the DataObject to edit the details it gives an Internal Server Error.
And a SQL query error is logged in the error logs:

[2020-10-13 13:07:31] error-log.ERROR:
Uncaught Exception SilverStripe\ORM\Connect\DatabaseException: "Couldn’t run query:

SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“buildkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15

Unknown column ‘Property.ClassName’ in ‘field list’" at /var/www/html/my-ss-project/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php line 64 {“exception”:"[object] (SilverStripe\ORM\Connect\DatabaseException(code: 0): Couldn’t run query:\n\nSELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“buildkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, \n\t\t\tCASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName”\n\t\t\tELSE ‘Builder’ END AS “RecordClassName”\n\nFROM “Builder”\nINNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID”\n\nWHERE (“Property_Builder”.“PropertyID” = ?)\n\nLIMIT 15\n\nUnknown column ‘Property.ClassName’ in ‘field list’ at /var/www/html/my-ss-project/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php:64)"}

Trace
SilverStripe\ORM\Connect\DBConnector->databaseError(Couldn’t run query: SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15 Unknown column ‘Property.ClassName’ in ‘field list’, 256, SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Array)
MySQLiConnector.php:302
SilverStripe\ORM\Connect\MySQLiConnector->preparedQuery(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Array, 256)
Database.php:185
SilverStripe\ORM\Connect\Database->SilverStripe\ORM\Connect{closure}(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15)
Database.php:258
SilverStripe\ORM\Connect\Database->benchmarkQuery(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Closure, Array)
Database.php:183
SilverStripe\ORM\Connect\Database->preparedQuery(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Array, 256)
MySQLDatabase.php:386
SilverStripe\ORM\Connect\MySQLDatabase->preparedQuery(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Array, 256)
DB.php:445
SilverStripe\ORM\DB::prepared_query(SELECT DISTINCT CASE WHEN “Property”.“ClassName” IN (‘Property’) THEN “Property_Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” WHEN “Builder”.“ClassName” IN (‘Builder’) THEN “Builder”.“propertykey” ELSE NULL END AS “propertykey”, “Property_Builder”.“builderkey”, “Property_Builder”.“sortorder”, “Builder”.“ClassName”, “Builder”.“LastEdited”, “Builder”.“Created”, “Builder”.“Version”, “Builder”.“preferred_name”, “Builder”.“mid_name”, “Builder”.“last_name”, “Builder”.“suffix”, “Builder”.“bio”, “Builder”.“ID”, CASE WHEN “Builder”.“ClassName” IS NOT NULL THEN “Builder”.“ClassName” ELSE ‘Builder’ END AS “RecordClassName” FROM “Builder” INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?) LIMIT 15, Array)
SQLExpression.php:115
SilverStripe\ORM\Queries\SQLExpression->execute()
DataList.php:743
SilverStripe\ORM\DataList->toArray()
DataList.php:868
SilverStripe\ORM\DataList->getIterator()
GridField.php:541
SilverStripe\Forms\GridField\GridField->FieldHolder()
call_user_func_array(Array, Array)
ViewableData.php:485
SilverStripe\View\ViewableData->obj(FieldHolder, , 1)
ViewableData.php:547
SilverStripe\View\ViewableData->XML_val(FieldHolder, , 1)
SSViewer_Scope.php:323
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:309
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.admin.themes.cms-forms.templates.SilverStripe.Forms.CMSTabSet.ss:52
include(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.admin.themes.cms-forms.templates.SilverStripe.Forms.CMSTabSet.ss)
SSViewer.php:602
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.admin.themes.cms-forms.templates.SilverStripe.Forms.CMSTabSet.ss, SilverStripe\Forms\TabSet, , Array, )
SSViewer.php:674
SilverStripe\View\SSViewer->process(SilverStripe\Forms\TabSet, )
ViewableData.php:401
SilverStripe\View\ViewableData->renderWith(SilverStripe\View\SSViewer)
TabSet.php:136
SilverStripe\Forms\TabSet->FieldHolder()
call_user_func_array(Array, Array)
ViewableData.php:485
SilverStripe\View\ViewableData->obj(FieldHolder, , 1)
ViewableData.php:547
SilverStripe\View\ViewableData->XML_val(FieldHolder, , 1)
SSViewer_Scope.php:323
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:309
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.Includes.LeftAndMain_EditForm.ss:161
include(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.Includes.LeftAndMain_EditForm.ss)
SSViewer.php:602
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.admin.templates.SilverStripe.Admin.Includes.LeftAndMain_EditForm.ss, SilverStripe\Forms\Form, , Array, )
SSViewer.php:674
SilverStripe\View\SSViewer->process(SilverStripe\Forms\Form, )
ViewableData.php:401
SilverStripe\View\ViewableData->renderWith(SilverStripe\View\SSViewer)
Form.php:1586
SilverStripe\Forms\Form->forTemplate()
ViewableData.php:549
SilverStripe\View\ViewableData->XML_val(ItemEditForm, , 1)
SSViewer_Scope.php:323
SilverStripe\View\SSViewer_Scope->__call(XML_val, Array)
SSViewer_DataPresenter.php:309
SilverStripe\View\SSViewer_DataPresenter->__call(XML_val, Array)
.cachevendor.silverstripe.framework.templates.SilverStripe.Forms.GridField.GridFieldDetailForm_ItemRequest.ss:2
include(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.framework.templates.SilverStripe.Forms.GridField.GridFieldDetailForm_ItemRequest.ss)
SSViewer.php:602
SilverStripe\View\SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php7.3.23-1+ubuntu18.04.1+deb.sury.org+1-var-www-html-my-ss-project/www-data/.cachevendor.silverstripe.framework.templates.SilverStripe.Forms.GridField.GridFieldDetailForm_ItemRequest.ss, SilverStripe\View\ViewableData_Customised, , Array, )
SSViewer.php:674
SilverStripe\View\SSViewer->process(SilverStripe\View\ViewableData_Customised, )
ViewableData.php:401
SilverStripe\View\ViewableData->renderWith(SilverStripe\View\SSViewer)
GridFieldDetailForm_ItemRequest.php:147
SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest->edit(SilverStripe\Control\HTTPRequest)
RequestHandler.php:323
SilverStripe\Control\RequestHandler->handleAction(SilverStripe\Control\HTTPRequest, edit)
RequestHandler.php:202
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
GridFieldDetailForm.php:130
SilverStripe\Forms\GridField\GridFieldDetailForm->handleItem(SilverStripe\Forms\GridField\GridField, SilverStripe\Control\HTTPRequest)
GridField.php:1138
SilverStripe\Forms\GridField\GridField->handleRequest(SilverStripe\Control\HTTPRequest)
RequestHandler.php:226
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
RequestHandler.php:226
SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
Controller.php:212
SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest)
LeftAndMain.php:757
SilverStripe\Admin\LeftAndMain->handleRequest(SilverStripe\Control\HTTPRequest)
AdminRootController.php:123
SilverStripe\Admin\AdminRootController->handleRequest(SilverStripe\Control\HTTPRequest)
Director.php:360
SilverStripe\Control\Director->SilverStripe\Control{closure}(SilverStripe\Control\HTTPRequest)
VersionedHTTPMiddleware.php:41
SilverStripe\Versioned\VersionedHTTPMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
ConfirmationMiddleware.php:254
SilverStripe\Control\Middleware\ConfirmationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
PasswordExpirationMiddleware.php:84
SilverStripe\Security\PasswordExpirationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
BasicAuthMiddleware.php:68
SilverStripe\Security\BasicAuthMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
AuthenticationMiddleware.php:61
SilverStripe\Security\AuthenticationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
ExecMetricMiddleware.php:20
SilverStripe\Control\Middleware\ExecMetricMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
CanonicalURLMiddleware.php:190
SilverStripe\Control\Middleware\CanonicalURLMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
HTTPCacheControlMiddleware.php:42
SilverStripe\Control\Middleware\HTTPCacheControlMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
ChangeDetectionMiddleware.php:28
SilverStripe\Control\Middleware\ChangeDetectionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
FlushMiddleware.php:27
SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
RequestProcessor.php:66
SilverStripe\Control\RequestProcessor->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
SessionMiddleware.php:20
SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
AllowedHostsMiddleware.php:60
SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
TrustedProxyMiddleware.php:176
SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\Director->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
Director.php:369
SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest)
HTTPApplication.php:117
SilverStripe\Control\HTTPApplication::SilverStripe\Control{closure}(SilverStripe\Control\HTTPRequest)
call_user_func(Closure, SilverStripe\Control\HTTPRequest)
HTTPApplication.php:136
SilverStripe\Control\HTTPApplication->SilverStripe\Control{closure}(SilverStripe\Control\HTTPRequest)
call_user_func(Closure, SilverStripe\Control\HTTPRequest)
ErrorControlChainMiddleware.php:67
SilverStripe\Core\Startup\ErrorControlChainMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
HTTPMiddlewareAware.php:62
SilverStripe\Control\HTTPApplication->SilverStripe\Control\Middleware{closure}(SilverStripe\Control\HTTPRequest)
HTTPMiddlewareAware.php:65
SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
HTTPApplication.php:137
SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, )
HTTPApplication.php:116
SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest)
index.php:25

Formatted so can see it better…

Did you run /dev/build to create the tables from your DataObjects?

SELECT DISTINCT CASE
WHEN “Property”.“ClassName” IN (‘Property’)
THEN “Property_Builder”.“propertykey”
WHEN “Builder”.“ClassName” IN (‘Builder’)
THEN “Builder”.“propertykey”
WHEN “Builder”.“ClassName” IN (‘Builder’)
THEN “Builder”.“propertykey”
WHEN “Builder”.“ClassName” IN (‘Builder’)
THEN “Builder”.“propertykey”
ELSE NULL END AS “propertykey”
, “Property_Builder”.“buildkey”
, “Property_Builder”.“sortorder”
, “Builder”.“ClassName”
, “Builder”.“LastEdited”
, “Builder”.“Created”
, “Builder”.“Version”
, “Builder”.“preferred_name”
, “Builder”.“mid_name”
, “Builder”.“last_name”
, “Builder”.“suffix”
, “Builder”.“bio”
, “Builder”.“ID”
, CASE WHEN “Builder”.“ClassName” IS NOT NULL
THEN “Builder”.“ClassName”
ELSE ‘Builder’
END AS “RecordClassName”
FROM “Builder”
INNER JOIN “Property_Builder” ON “Property_Builder”.“BuilderID” = “Builder”.“ID” WHERE (“Property_Builder”.“PropertyID” = ?)
LIMIT 15

Yes, I did run a /dev/build.
It was running fine in Silverstripe version 3 but on upgrading to version 4.5 now its not working.
The table and data were already there in the Database. So, in the CMS I can see the list of Property DataObjects there, when I click on one of them to edit it gives an Internal Server Error and the above error is reported in the error logs.