Bug 51 : Entity based on VIEW ... view not found... get NPE NullPointerException etc
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.0.1
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
15/12/2008
Updated 
15/12/2008
Type 
Bug
 
Attachments 
No attachments

When basing an @Entity on a database view instead of a table. Get a NPE.

 
Rob 15 Dec 10:24
See Topic 90

Exception in thread "main" java.lang.NullPointerException
at com.avaje.ebean.server.deploy.DeployPropertyParser.convertWord(DeployPropertyParser.java:34)
at com.avaje.ebean.server.deploy.DeployParser.parse(DeployParser.java:50)
at com.avaje.ebean.server.query.CQueryPredicates.parsePropertiesToDbColumns(CQueryPredicates.java:279)
at com.avaje.ebean.server.query.CQueryPredicates.prepare(CQueryPredicates.java:262)
at com.avaje.ebean.server.query.CQueryBuilder.buildQuery(CQueryBuilder.java:153)
at com.avaje.ebean.server.query.DefaultOrmQueryEngineHelper.findMany(DefaultOrmQueryEngineHelper.java:77)
at com.avaje.ebean.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:93)
at com.avaje.ebean.server.core.QueryRequest.findList(QueryRequest.java:172)
at com.avaje.ebean.server.core.DefaultServer.findList(DefaultServer.java:989)
at com.avaje.ebean.query.DefaultOrmQuery.findList(DefaultOrmQuery.java:394)
at TestEbean.main(TestEbean.java:11)
java.lang.NullPointerException
at com.avaje.ebean.server.autofetch.DefaultAutoFetchManager.updateTunedQueryInfo(DefaultAutoFetchManager.java:332)
at com.avaje.ebean.server.autofetch.DefaultAutoFetchManager.collectUsageViaGC(DefaultAutoFetchManager.java:302)
at com.avaje.ebean.server.autofetch.DefaultAutoFetchManager.shutdown(DefaultAutoFetchManager.java:270)
at com.avaje.ebean.server.core.DefaultServer$Shutdown.run(DefaultServer.java:217)
at com.avaje.ebean.server.lib.ShutdownManager.shutdown(ShutdownManager.java:169)
at com.avaje.ebean.server.lib.ShutdownHook.run(ShutdownHook.java:47)

Rob 15 Dec 10:28
TableSearch

The issue looks to be with com.avaje.ebean.server.lib.sql.TableSearch

Specifically String[] TABLE_TYPES = { "TABLE", "VIEW" }; did not include "VIEW" so only searched the dictionary for "TABLE" table types.

Changing this means the dictionary search will find VIEW's as well as TABLE's.

NOTE: With views some things that are automatically detected for tables such as primary keys and foreign key relationships etc need to be manually defined. There may be outstanding bugs where using a view generates a confusing error compared with using a table.

Rob 16 Dec 10:35
Fixed in 1.0.1

Fixed in 1.0.1

woResponse

Upload a file