google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

ObjectifyFactory.register() does not conform to its contract. #130

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to register the same entity twice using 
ObjectifyService.factory().register(Class)
2.
3.

What is the expected output? What do you see instead?

The Javadoc states: "Attempts to re-register entity classes are ignored.". 
Which is the ideal behavior. However, when I attempt to register an entity a 
second time, an exception is generated:

Caused by: java.lang.IllegalArgumentException: Attempted to register kind 
'Event' twice
    at com.googlecode.objectify.impl.Registrar.register(Registrar.java:82)
    at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:209)

What version of the product are you using? On what operating system?

3.1

Please provide any additional information below.

I do not use DAO (as encouraged by the documentation) nor do I intend to write 
a "warmup" servlet. So I register my Entities with Objectify as needed. If the 
register() method conformed to the contract specified in the Javadoc my code 
would work fine. 

Original issue reported on code.google.com by mi...@threedev.com on 21 Jul 2012 at 7:24

GoogleCodeExporter commented 9 years ago
You must be looking at the "Current Javadocs" which reflect the code at HEAD 
(Objectify v4).  Objectify4 does in fact ignore duplicate registration 
attempts, but 3.1 throws an exception.

I have added a link to v3.1 javadocs on the home page and updated the current 
link to mention v4.  Sorry about the confusion!

Original comment by lhori...@gmail.com on 28 Jul 2012 at 1:17