I’m using an existing DB from an open source application (OSTicket). There are two tables (OstStaff and OstTicket, where staff hasMany Tickets). However, the big problem is OSTicket assigns a default value of zero to OstTicket.staff_id, when the ticket is not yet assigned to an OstStaff.
The issue arises when you search for tickets and GORM thinks that there is a staff with index equal to 0. I can’t even check for null, just keep getting this error:
No row with the given identifier exists: [com.facilities.model.OstFacStaff#0].
Stacktrace follows:
Message: No row with the given identifier exists: [com.facilities.model.OstFacStaff#0]
Any suggestion how I can get around this issue? Thanks.
Solved this by just getting the ids, rather than the record, and then removing the zero index.