Skip to content

parsing ORM file with table generator tag #126

Closed
iabughosh opened this Issue Dec 24, 2012 · 3 comments

2 participants

@iabughosh

Dears,
I'm unable to use orm mapping, Batoo throws an exception when my orm contains table-generator tag.

regards.

@asimarslan
Batoo Software member

Hi, @iabughosh
Can you provide the exception log dump and more detail on the orm.xml , especially table-generator tag part.

I will handle this with your related issue #125 .

Thanks

@iabughosh iabughosh closed this Dec 25, 2012
@iabughosh iabughosh reopened this Dec 25, 2012
@iabughosh

hello asimarslan,
here is exception : Caused by: org.batoo.common.BatooException: Unable to parse ORM XML File META-INF/orm.xml
at org.batoo.jpa.parser.impl.OrmParser.consume(OrmParser.java:80)
at org.batoo.jpa.parser.PersistenceParserImpl.parseOrmXml(PersistenceParserImpl.java:225)
at org.batoo.jpa.parser.PersistenceParserImpl.parseOrmXmls(PersistenceParserImpl.java:248)
at org.batoo.jpa.parser.PersistenceParserImpl.(PersistenceParserImpl.java:96)
at org.batoo.jpa.core.BatooPersistenceProvider.createContainerEntityManagerFactory(BatooPersistenceProvider.java:69)
at org.batoo.jpa.core.BatooPersistenceProvider.createContainerEntityManagerFactory(BatooPersistenceProvider.java:43)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.batoo.jpa.parser.MappingException: Unexpected element 'table-generator' encountered.
at org.batoo.jpa.parser.impl.orm.Element.expected(Element.java:269)
at org.batoo.jpa.parser.impl.orm.OrmContentHandler.startElement(OrmContentHandler.java:197)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:496)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:275)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)
at org.batoo.jpa.parser.impl.OrmParser.consume(OrmParser.java:77)
... 12 more

my orm.xml is like this :
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

<persistence-unit-metadata>     
    <persistence-unit-defaults>         
        <schema>team7</schema>
        <entity-listeners>
            <entity-listener class="org.bbt.entity.listener.EntityListener">
                <pre-persist method-name="prePersist"/>                     
                <post-persist method-name="postPersist"/>
            </entity-listener>
        </entity-listeners>
    </persistence-unit-defaults>        
</persistence-unit-metadata>

<table-generator name="userGen" 
                 allocation-size="1"
                 initial-value="1"
                 table="t7_sequence"
                 pk-column-name="GEN_NAME"
                 pk-column-value="USER_SEQ"
                 value-column-name="GEN_VALUE"/>

<named-query name="User.fetchAll">
    <query><![CDATA[SELECT u FROM User u ORDER BY u.username]]></query>
</named-query>
<named-native-query name="User.fetchAllNative" 
                    result-class="org.bbt.entity.listener.User">
    <query><![CDATA[SELECT t.* FROM t7_user t]]></query>
</named-native-query>
<named-native-query name="User.Count" 
                    result-class="org.bbt.entity.listener.User"
                    result-set-mapping="COUNT">
    <query><![CDATA[SELECT COUNT(*) TOTAL_COUNT FROM t7_user]]></query>
</named-native-query>
<sql-result-set-mapping name="COUNT">
    <column-result name="TOTAL_COUNT"/>     
</sql-result-set-mapping>

regards.

@asimarslan
Batoo Software member

Thanks @iabughosh ,

I found the problem, patch is on the way.

Please note that native queries are in progress, see issue #83

@asimarslan asimarslan was assigned Jan 16, 2013
@asimarslan asimarslan closed this Jan 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.