Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003071 [Resin] major always 11-13-08 12:10 12-15-08 09:22
Reporter dicr View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.0 Product Version 3.2.1
  Product Build
Summary 0003071: EJB 3.0 may not have public constructor
Description [22:06:22.246] {http--8443-9} Caused by: com.caucho.config.ConfigException: 'org.dicr.isp.ejb.PaymentDO' needs a public or protected no-arg constructor. Entity beans must have a public or protected no-arg constructor.
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.AbstractConfigIntrospector.validateConstructor(AbstractConfigIntrospector.java:187)
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.AbstractConfigIntrospector.validateType(AbstractConfigIntrospector.java:160)
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.EntityIntrospector.introspectEntityType(EntityIntrospector.java:254)
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.EntityIntrospector.introspect(EntityIntrospector.java:105)
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.AmberConfigManager.introspect(AmberConfigManager.java:85)
[22:06:22.246] {http--8443-9} at com.caucho.amber.manager.AmberPersistenceUnit.addEntityClass(AmberPersistenceUnit.java:510)
[22:06:22.246] {http--8443-9} at com.caucho.amber.cfg.PersistenceUnitConfig.init(PersistenceUnitConfig.java:343)
Steps To Reproduce
Additional Information @Entity
public class PaymentDO implements Serializable {
    protected PaymentDO() {
        super();
    }
}

There will no error, if I will change constructor to 'public'.
But error says 'public or protected no-arg constructor'.
Attached Files

- Relationships

- Notes
(0003550)
dicr
11-17-08 19:41

ejb-3_0-fr-spec-persistence.pdf
2.1 Requirements on the Entity Class

"The entity class must have a no-arg constructor. The entity class may have other constructors as well. The no-arg constructor must be public or protected."

But Resin accept only public constructor. In my application public constructor is not acceptable, because I want to force use of my beans by user with right constructor with arguments. For example, I need to allow user to use:

@Entity
public class LoginDO {
    @Basic private String _name;

    protected LoginDO() {
        super();
    }

    public LoginDO(String name) {
        this.setName(name);
    }

    public void setName(String name) {
        if (name == null || name.length() < 1) throw new IllegalArgumentException("incorrect name");
        this._name = name;
}

I need to hide non-arg constructpr from user with 'protected' access.
But resin force me to make non-arg constructor public :(
 
(0003637)
ferg
12-15-08 09:22

jpa/0g0r
 

- Issue History
Date Modified Username Field Change
11-13-08 12:10 dicr New Issue
11-16-08 03:35 dicr Issue Monitored: dicr
11-17-08 19:41 dicr Note Added: 0003550
12-15-08 09:22 ferg Note Added: 0003637
12-15-08 09:22 ferg Assigned To  => ferg
12-15-08 09:22 ferg Status new => closed
12-15-08 09:22 ferg Resolution open => fixed
12-15-08 09:22 ferg Fixed in Version  => 4.0.0


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker