The DB portion has been fixed, but the generation of the other Java
classes is still broken.  See -
   https://issues.apache.org/jira/browse/OPENJPA-1091


-Donald

On 1/22/10 1:25 PM, AniJ wrote:
> 
> Apologies for this long post. But the ReverseMappingTool seems to be giving
> some problem. I was trying to reverse map my DB tables (in Derby) so I tried
> it with the "reversemapping example" code and still gives the same problem.
> Can anyone help? Problem described below.
> 
> I am using apache-openjpa-2.0.0-M3. I navigate to the example folder. Run
> the build using command "ant". As expected (since I am using Derby) this
> this gives error related to the databased connection. which says:
> 
> [reversemappingtool] 1138  none  INFO   [main] openjpa.Tool - The reverse
> mappin
> g tool will run on the database.  The tool is gathering schema information;
> this
>  process may take some time.  Enable the org.apache.openjpa.jdbc.Schema
> logging
> category to see messages about schema data.
> [reversemappingtool] 3400  none  INFO   [main] openjpa.jdbc.JDBC - Using
> diction
> ary class "org.apache.openjpa.jdbc.sql.DerbyDictionary".
> [reversemappingtool] <openjpa-2.0.0-M3-r422266:822833 fatal user error>
> org.apac
> he.openjpa.util.UserException: A connection could not be obtained for driver
> cla
> ss "org.apache.derby.jdbc.EmbeddedDriver" and URL
> "jdbc:derby:D:\Ani\Dev\apache-
> openjpa-2.0.0-M3\examples\reversemapping/reversemapping-database;create=true".
> You may have specified an invalid URL.
> 
> 
> As I understand the this is caused by the Derby Embedded Driver. However the
> "reversemapping-database" is successfully created and the data from sql
> scripts is populated in the tables. So I run the ant script again as below:
> ant -Dinitialize-db-skip=true
> 
> This time it runs but the problem is it creates only one file called
> Airline.java and it includes all the fields of all the tables Airline.java.
> Even the orm.xml looks like all the field of all the tables are mapped to a
> single Airline class. I have attached both the generated files. Any help?
> 
> The console output of the command is as below:
> 
> Buildfile:
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reversemapping\build.xml
> 
> initialize-db:
> 
> reverse-map-schema:
> [reversemappingtool] 1061  none  INFO   [main] openjpa.Tool - The reverse
> mappin
> g tool will run on the database.  The tool is gathering schema information;
> this
>  process may take some time.  Enable the org.apache.openjpa.jdbc.Schema
> logging
> category to see messages about schema data.
> [reversemappingtool] 3354  none  INFO   [main] openjpa.jdbc.JDBC - Using
> diction
> ary class "org.apache.openjpa.jdbc.sql.DerbyDictionary".
> [reversemappingtool] 9547  none  INFO   [main] openjpa.Tool -
> ReverseMappingTool
>  : generating classes.
> [reversemappingtool] 9547  none  INFO   [main] openjpa.MetaData - Customized
> nam
> e found for class "reversemapping.Airlines": will rename as
> "reversemapping.Airl
> ine".
> [reversemappingtool] 10437  none  INFO   [main] openjpa.MetaData -
> Customized na
> me found for field "airline" in type "reversemapping.Airline": will rename
> as "r
> eversemapping.Airline".
> [reversemappingtool] 10515  none  INFO   [main] openjpa.MetaData -
> Customized na
> me found for field "airlineFull" in type "reversemapping.Airline": will
> rename a
> s "reversemapping.Airline".
> [reversemappingtool] 10530  none  WARN   [main] openjpa.MetaData - Column
> "AIRLI
> NES.MEAL" is type CHAR(1), but OpenJPA cannot reverse map it into a Java
> char be
> cause OpenJPA is currently configured to store Java chars into numeric
> database
> columns.  To configure OpenJPA to store Java chars into CHAR(1) columns, set
> the
>  following property:
> [reversemappingtool] openjpa.jdbc.DBDictionary: StoreCharsAsNumbers=false
> [reversemappingtool] 10561  none  INFO   [main] openjpa.MetaData - Table
> "SYSIBM
> .AIRLINES" could not be reverse mapped.  This means that the table does not
> have
>  a primary key (primary keys are required to establish unique identifiers
> for al
> l persistent objects) and does not match a known pattern for a table used
> for cr
> oss-reference or value collections.
> [reversemappingtool] 10561  none  INFO   [main] openjpa.MetaData - Table
> "SYS.AI
> RLINES" could not be reverse mapped.  This means that the table does not
> have a
> primary key (primary keys are required to establish unique identifiers for
> all p
> ersistent objects) and does not match a known pattern for a table used for
> cross
> -reference or value collections.
> [reversemappingtool] 10593  none  INFO   [main] openjpa.Tool - Writing
> generated
>  class source code.
> [reversemappingtool] 10593  none  INFO   [main] openjpa.MetaData - Writing
> java
> code for generated type "reversemapping.Airline".
> [reversemappingtool] 10608  none  INFO   [main] openjpa.Tool - Writing
> generated
>  metadata.
> [reversemappingtool] 10655  none  INFO   [main] openjpa.MetaData - Writing
> to fi
> le "orm.xml".
> [reversemappingtool] 10702  none  INFO   [main] openjpa.MetaData - Writing
> class
>  "reversemapping.Airline".
>      [move] Moving 1 file to
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reverse
> mapping
> 
> pre-compile:
> 
> compile:
>     [javac] D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\build.xml:102:
> warning:
> 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set
> to f
> alse for repeatable builds
>     [javac] Compiling 2 source files
>     [javac]
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reversemapping\Main.java
> :52: cannot find symbol
>     [javac] symbol  : class Availability
>     [javac] location: class reversemapping.Main
>     [javac]         List<Availability> schedule = (List<Availability>)
>     [javac]              ^
>     [javac]
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reversemapping\Main.java
> :52: cannot find symbol
>     [javac] symbol  : class Availability
>     [javac] location: class reversemapping.Main
>     [javac]         List<Availability> schedule = (List<Availability>)
>     [javac]                                             ^
>     [javac]
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reversemapping\Main.java
> :57: cannot find symbol
>     [javac] symbol  : class Availability
>     [javac] location: class reversemapping.Main
>     [javac]        for (Availability avail : schedule) {
>     [javac]             ^
>     [javac]
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\reversemapping\Main.java
> :58: cannot find symbol
>     [javac] symbol  : class Flight
>     [javac] location: class reversemapping.Main
>     [javac]            Flight flight = avail.getFlight();
>     [javac]            ^
>     [javac] 4 errors
> 
> BUILD FAILED
> D:\Ani\Dev\apache-openjpa-2.0.0-M3\examples\build.xml:102: Compile failed;
> see t
> he compiler error output for details.
> 
> Total time: 13 seconds
> 
> 
> http://n2.nabble.com/file/n4441686/Airline.java Airline.java 
> http://n2.nabble.com/file/n4441686/orm.xml orm.xml 

Reply via email to