-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: Exception : identifier mapping has wrong number of columns
PostPosted: Wed May 12, 2004 3:55 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
Hi ,

I'm getting the following exception.

Can anyone of you help me out with only the cause for the same


Code:
net.sf.hibernate.MappingException: identifier mapping has wrong number of columns: com.agile.ws.folder.WSFolder type: object
   at net.sf.hibernate.mapping.RootClass.validate(RootClass.java:201)
   at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:587)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:744)
   at com.agile.orlayer.ORLayerManager.<clinit>(ORLayerManager.java:79)
   at com.agile.ws.folder.dao.FolderLoadDBDAO.getFolderTree(FolderLoadDBDAO.java:96)
   at com.agile.ws.folder.dao.FolderLoadDBDAO.main(FolderLoadDBDAO.java:163)
com.agile.common.dao.DAOSystemException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
   at com.agile.orlayer.ORLayerManager.getConnection(ORLayerManager.java:147)
   at com.agile.orlayer.ORLayerManager.<init>(ORLayerManager.java:127)
   at com.agile.ws.folder.dao.FolderLoadDBDAO.getFolderTree(FolderLoadDBDAO.java:96)
   at com.agile.ws.folder.dao.FolderLoadDBDAO.main(FolderLoadDBDAO.java:163)


thanks a TON in advance
Santosh
Exception in thread "main"


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 3:59 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
Hi,

Could you give the mapping files and the java code please?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 4:07 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
_charles_ wrote:
Hi,

Could you give the mapping files and the java code please?



here are the relevant mappings and Java codes

Code:


public class WSFolder extends Folder  {

   public WSFolder(final Object id) {
      this(id, _wsfolderCD);
   }
   public WSFolder(final Object id, final ClassifierDescriptor cd) {
      super(id, cd);
   }
   // APIs to be used by DAO layer to instantiate this data object.
   public WSFolder(final long id) {
      this(new Identity(_wsfolderCD.getQualifiedName(), id), _wsfolderCD);
   }
   public List getWSProjects() {
      return getNestedObjects();
   }
   public void setWSProjects(List projects) {
      setNestedObjects(projects);
   }
   // APIs to be used by DAO layer only
   public void addWSProject(WSProjectNestedObject project) {
      addNestedObject(project);
   }
   private static ClassDescriptor _wsfolderCD;
   static {
WSFoldersBusinessObject.toMetadataManager();
    _wsfolderCD = mmgr.findClass("agile.wsfolder.Folder");
   }
}



The base class Folder.java is as follows

Code:
public class Folder extends NestedDataObject {
   protected String name, description, owner;
   protected Date lastmodified;
   protected List nested;
   protected List children;
   public Folder(final Object id) {
      this(id, _folderCD);
   }
   public Folder(final Object id, final ClassifierDescriptor cd) {
      super(id, cd);
   }
   // APIs to be used by DAO layer to instantiate this data object.
   public Folder(final long id) {
      this(new Identity(_folderCD.getQualifiedName(), id), _folderCD);
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public String getDescription() {
      return description;
   }
   public void setDescription(String desc) {
      this.description = desc;
   }
   public String getOwnerName() {
      return owner;
   }
   public void setOwnerName(String owner) {
      this.owner = owner;
   }
   public Date getLastModified() {
      return lastmodified;
   }
   public void setLastModified(Date lastmodified) {
      this.lastmodified = lastmodified;
   }
   public List getNestedObjects() {
      return nested;
   }
   public void setNestedObjects(List nested) {
      this.nested = nested;
   }
   // APIs to be used by DAO layer only
   public void addNestedObject(NestedDataObject ndo) {
      if(nested == null) nested = new ArrayList(10);
      nested.add(ndo);
   }
   public List getNestedFolders() {
      return children;
   }
   public void setNestedFolders(List children) {
      this.children = children;
   }
   // APIs to be used by DAO layer only
   public void addNestedFolder(Folder child) {
      if(children == null) children = new ArrayList(10);
      children.add(child);
   }
   private static ClassDescriptor _folderCD;
   static {
  MetadataManager mmgr = WSFoldersBusinessObject.toMetadataManage();
  _folderCD = mmgr.findClass("agile.wsproduct.Folder");
   }
}




The mapping is

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.agile.ws.folder">
   <class name="WSFolder" table="AGILEFOLDER"  proxy="WSFolder" >
      <id name="m_id">
         <generator class="native"/>
      </id>
      <property name="name" column="name" type="string"/>
      <property name="description" column="description" type="string"/>
      <property name="owner" column="owner" type="long"/>
      <property name="lastmodified" column="modified_on" type="date"/>
   </class>
</hibernate-mapping>



The field m_id is a protected member variable in the Abstract class AbstractDataObject which is extended by NestedDataObject. And NestedDataObject is extended by the Base folder class i.e. Folder (which is finally extended by WSFolder)

hope this helps..

thanks Santosh


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 4:41 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
I can't guarantee that it comes from it, but you declared the owner as a String and mapped it as a long...

Tell me if it helps...

Charles


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 5:41 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
_charles_ wrote:
I can't guarantee that it comes from it, but you declared the owner as a String and mapped it as a long...

Tell me if it helps...

Charles



Thanks for rectifying me but the problem seems to persist..


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 5:43 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
santosh wrote:
_charles_ wrote:
I can't guarantee that it comes from it, but you declared the owner as a String and mapped it as a long...

Tell me if it helps...

Charles



Thanks for rectifying me but the problem seems to persist..


Actually , the exception message says that the identifier mapping has wrong no. of columns..

I was wondering on what should be intrepeted from the above stmt.


~santosh


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 6:02 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
OK...

Maybe you could give a description of the table in the database...

Did you use the hbm2ddl tool or did you create the tables yourself?

Charles


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 6:06 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
_charles_ wrote:
OK...

Maybe you could give a description of the table in the database...

Did you use the hbm2ddl tool or did you create the tables yourself?

Charles


here's the db sql create script for the table

Code:
CREATE TABLE AGILEFOLDER
(
  ID             NUMBER(10)                     NOT NULL,
  NAME           VARCHAR2(300),
  QUALIFIEDNAME  VARCHAR2(300),
  DESCRIPTION    VARCHAR2(300),
  ISROOT         NUMBER(1),
  FOLDERTYPE     NUMBER,
  OWNER          NUMBER(10),
  VISIBILITY     NUMBER,
  CREATED_ON     DATE,
  MODIFIED_ON    DATE
)
TABLESPACE SYSTEM
PCTUSED    40
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
LOGGING
NOCACHE
NOPARALLEL;


CREATE UNIQUE INDEX PK_AGILEFOLDER ON AGILEFOLDER
(ID)
LOGGING
TABLESPACE SYSTEM
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


ALTER TABLE AGILEFOLDER ADD (
  CONSTRAINT PK_AGILEFOLDER PRIMARY KEY (ID)
    USING INDEX
    TABLESPACE SYSTEM
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
               ));


NB ignore the m_id field. It has been replaced by 'id' which is now the identifier member field in Folder.java

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 6:10 am 
Newbie

Joined: Mon Mar 22, 2004 5:23 am
Posts: 18
Location: Bangalore
santosh wrote:
santosh wrote:
_charles_ wrote:
I can't guarantee that it comes from it, but you declared the owner as a String and mapped it as a long...

Tell me if it helps...

Charles



Thanks for rectifying me but the problem seems to persist..


Actually , the exception message says that the identifier mapping has wrong no. of columns..

I was wondering on what should be intrepeted from the above stmt.


~santosh



Hi charles,

leave it for the moment. I think I've got the error..Initially the 'm_id' field ,in the (super most)Abstract class AbstractDataObject ,happened to be of Object type. I tried an alternative by introducing a (primitive) long filed 'id' in Folder.java..And the problem got fixed..

However, I don't think I can live with that newly intorduced field..
Anyway, have got a temp. soln.

Thanks a lot for the interest shown.

regards
Santosh


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 6:17 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
Maybe the problem comes from this :

In Hibernate documentation :
Quote:
4.1.4. Prefer non-final classes (optional)
A central feature of Hibernate, proxies, depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods.

You can persist final classes that do not implement an interface with Hibernate, but you won't be able to use proxies - which will limit your options for performance tuning somewhat.


So, you could try to remove the proxy declaration in the mapping file.

I hope this helps.

Charles


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.