From: Jochen R. <joc...@si...> - 2002-11-25 14:45:02
|
Thanks for your help, but exactly in the line with the colum tag (corresponds to line 15) the schema generator shows an error: <property name="ownernumber"> <column name="ownernumber" type="string" length="50" not-null="true" index="index_name"/> </property> Any ideas ??? Kind regards Jochen Rebhan joc...@si... My message from the Schema generator: Arguments: processing mapping for class: buddy.database.Meetings processing mapping for class: buddy.database.Friend property "ownernumber" in class Friend is missing a type attribute Copying 2 files to C:\java\buddySrv\src Compiling 2 source files to C:\java\buddySrv\web\WEB-INF\classes (cirrus.hibernate.helpers.XMLHelper$1.error:38) - Error parsing XML: src/buddy/database/Friend.hbm.xml(15) org.xml.sax.SAXParseException: Attribute "type" must be declared for element type "column". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at cirrus.hibernate.helpers.XMLHelper.parseInputSource(XMLHelper.java:48) at cirrus.hibernate.helpers.XMLHelper.parseFile(XMLHelper.java:22) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) (cirrus.hibernate.helpers.XMLHelper$1.error:38) - Error parsing XML: src/buddy/database/Friend.hbm.xml(15) org.xml.sax.SAXParseException: Attribute "lenth" must be declared for element type "column". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at cirrus.hibernate.helpers.XMLHelper.parseInputSource(XMLHelper.java:48) at cirrus.hibernate.helpers.XMLHelper.parseFile(XMLHelper.java:22) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) (cirrus.hibernate.impl.DatastoreImpl.store:106) - Could not compile the mapping document cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) rethrown as cirrus.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:191) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) Caused by: cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) ... 6 more (cirrus.hibernate.impl.DatastoreImpl.storeFile:71) - Could not configure datastore from file: src/buddy/database/Friend.hbm.xml Error creating schema Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) rethrown as cirrus.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:191) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) Caused by: cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) ... 6 more at cirrus.hibernate.map.Root.<init>(Root.java:145) rethrown as cirrus.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:72) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) Caused by: cirrus.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:191) at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) rethrown as at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) cirrus.hibernate.MappingException: Problem trying to set property type by reflection: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:191) ... 1 more Caused by: cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.map.PersistentClass.propertiesFromXML(PersistentClass.java:97) at cirrus.hibernate.map.RootClass.<init>(RootClass.java:230) at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.map.Root.<init>(Root.java:145) at cirrus.hibernate.impl.DatastoreImpl.store(DatastoreImpl.java:103) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) ... 6 more at cirrus.hibernate.impl.DatastoreImpl.storeFile(DatastoreImpl.java:68) at cirrus.hibernate.tools.SchemaExport.main(SchemaExport.java:203) Caused by: cirrus.hibernate.MappingException: Could not find a getter for ownernumber in class buddy.database.Friend at cirrus.hibernate.helpers.ReflectHelper.getGetterMethod(ReflectHelper.java:119) at cirrus.hibernate.helpers.ReflectHelper.reflectedPropertyType(ReflectHelper.java:163) at cirrus.hibernate.map.Value.setTypeByReflection(Value.java:180) ... 6 more 25-11-2002 14:10:18, "Gavin King" <ga...@ap...> wrote: >Since everyone should be in the process of upgrading to version 1.2 ;) you >should now be using hibernate-mapping-1.1.dtd... > ><property name="ownernumber"> > <column name="ownernumber" type="string" length="50" not-null="true" >index="index_name"/> ></property> > >----- Original Message ----- >From: "Jochen Rebhan" <joc...@si...> >To: <hib...@li...> >Sent: Tuesday, November 26, 2002 1:07 AM >Subject: [Hibernate] How to create an index on normal property element ? > > >> >> I have the following hibernate-mapping definition for "Friend" : >> >> <class name="buddy.database.Friend" table="friends"> >> <id column="friends_key" name="key" type="long"> >> <generator class="native"/> >> </id> >> <set role="meetings" lazy="true" table="participants"> >> <key type="long" column="friends_key"/> >> <many-to-many class="buddy.database.Meetings" >column="meetings_key"/> >> </set> >> <property name="name" column="name" type="string" length="50"/> >> <property name="number" column="number" type="string" length="50" >not-null="true"/> >> >> >> <!-- I want to index this element: ownernumber to speed up some queries > --> >> <property name="ownernumber" column="ownernumber" type="string" >length="50" not-null="true"/> >> >> >> <property name="active" column="active" type="boolean" length="50" >/> >> >> </class> >> >> >> >> >> In Mysql I have to add this line manually (after running the Schema >generator) : >> >> create index ownerindex on friends (ownernumber); >> >> >> >> As I see in the DTD there is no way to specify an index for a normal >property, am I wrong ? >> >> >> >> <!ELEMENT property (column*)> >> <!ATTLIST property name CDATA #REQUIRED> >> <!ATTLIST property type CDATA #IMPLIED> >> <!ATTLIST property column CDATA #IMPLIED> >> <!ATTLIST property length CDATA #IMPLIED> >> <!ATTLIST property not-null (true|false) "false"> >> <!ATTLIST property unique (true|false) "false"> >> >> >> Thanks for any help, Hibernate is great ! >> >> >> Jochen Rebhan >> joc...@si... >> >> >> >> >> >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> hibernate-devel mailing list >> hib...@li... >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > |