Bug 85 : avoid creating sequence names on "sql only" based entities
Priority 
High
Reported Version 
 
Logged By 
imario
Status 
Fixed
Fixed Version 
1.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
04/03/2009
Updated 
04/03/2009
Type 
Bug
 
Attachments 
No attachments

I created an (read-only) entity which just uses sql to gather the data from the database, no table name specified for the entity.

The new naming code will NPE when determining a sequence name.


This patch will fix it:

Index: ../ebean/src/com/avaje/ebean/server/deploy/BeanDescriptorFactory.java
===================================================================
--- ../ebean/src/com/avaje/ebean/server/deploy/BeanDescriptorFactory.java (revision 156)
+++ ../ebean/src/com/avaje/ebean/server/deploy/BeanDescriptorFactory.java Wed Mar 04 13:18:59 CET 2009
@@ -637,7 +636,7 @@
}
}

- if (supportsSequences) {
+ if (supportsSequences && desc.getBaseTable() != null) {
// Derive the SequenceNextVal and set it to the descriptor.
// Note: the sequence only gets used *IF* the value of the
// id property is null when inserted. This is the default

I intentionally check for baseTabel at a high level as I think using sequences with sql-only based entities does not make much sense, does it?

 
Rob 05 Mar 06:58
Yes. I'll make this change

I had fixed the NPE later down in my NamingConvention implementation... but I think you are correct... and making this change is a better approach (for people developing their own naming convention implementations).

Rob 05 Mar 07:03
Fixed in HEAD

Fixed in HEAD.

woResponse

Upload a file