What Template is CreateTable.getSql() Looking For?

View: New views
4 Messages — Rating Filter:   Alert me  

What Template is CreateTable.getSql() Looking For?

by David Medinets :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi. I'm trying to get a message to Geert Bevin about RIFE. I'm trying
to use the CreateTable.getSql() method but it is complaining that a
template file is not available. Is there an example of this template?

Hi. I would like to use the CreateTable class in RIFE to generate the
CREATE TABLE Sql statements for my application. However, I am running
into a problem.

Here is the Java code that I am using:

        CreateTable create = new CreateTable(new Datasource());

        create.table("beer")
            .columns(Beer.class)
            .precision("brand", 50)
            .nullable("brand", CreateTable.NOTNULL);

        System.out.println(create.getSql());

When I execute this code, I get the following error:

Exception in thread "main"
com.uwyn.rife.template.exceptions.TemplateNotFoundException: Couldn't
find template 'sql.null.create_table'.
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:418)
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:365)
        at com.uwyn.rife.database.queries.CreateTable.getSql(CreateTable.java:128)
        at org.affy.play.PlayCreateTable.doIt(PlayCreateTable.java:22)
        at org.affy.play.PlayCreateTable.main(PlayCreateTable.java:30)
Caused by: java.lang.ClassNotFoundException: Couldn't resolve
template: 'com.uwyn.rife.template.sql.sql.null.create_table'.

I assume this template is sought by the following line of code in
CreateTable.getSql():

  Template template =
TemplateFactory.SQL.get("sql."+StringUtils.encodeClassname(mDatasource.getAliasedDriver())+".create_table");


What template is RIFE looking for? Is there an example that I can see?

thanks,
david


Re: What Template is CreateTable.getSql() Looking For?

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David,

RIFE handled the difference in SQL dialects through the use of  
templates that contain all the different parts of the database-
specific language variations.

The fact that you get this exception is because you create an empty  
datasource (ie. without the specification of a JDBC driver). The JDBC  
driver is used to look up the SQL dialect template, which is shipped  
with RIFE.

You can find the names of all the supported drivers here:
http://rifers.org:8088/viewrep/rifers/rife/trunk/programs/unittests/ 
config/rep/unittests_datasources.xml?r=trunk

Best regards,

Geert

On 2-nov-05, at 00:00, David Medinets wrote:

> Hi. I'm trying to get a message to Geert Bevin about RIFE. I'm trying
> to use the CreateTable.getSql() method but it is complaining that a
> template file is not available. Is there an example of this template?
>
> Hi. I would like to use the CreateTable class in RIFE to generate the
> CREATE TABLE Sql statements for my application. However, I am running
> into a problem.
>
> Here is the Java code that I am using:
>
>         CreateTable create = new CreateTable(new Datasource());
>
>         create.table("beer")
>             .columns(Beer.class)
>             .precision("brand", 50)
>             .nullable("brand", CreateTable.NOTNULL);
>
>         System.out.println(create.getSql());
>
> When I execute this code, I get the following error:
>
> Exception in thread "main"
> com.uwyn.rife.template.exceptions.TemplateNotFoundException: Couldn't
> find template 'sql.null.create_table'.
> at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:
> 418)
> at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:
> 365)
> at com.uwyn.rife.database.queries.CreateTable.getSql
> (CreateTable.java:128)
> at org.affy.play.PlayCreateTable.doIt(PlayCreateTable.java:22)
> at org.affy.play.PlayCreateTable.main(PlayCreateTable.java:30)
> Caused by: java.lang.ClassNotFoundException: Couldn't resolve
> template: 'com.uwyn.rife.template.sql.sql.null.create_table'.
>
> I assume this template is sought by the following line of code in
> CreateTable.getSql():
>
>   Template template =
> TemplateFactory.SQL.get("sql."+StringUtils.encodeClassname
> (mDatasource.getAliasedDriver())+".create_table");
>
>
> What template is RIFE looking for? Is there an example that I can see?

--
Geert Bevin                       Uwyn bvba
"Use what you need"               Avenue de Scailmont 34
http://www.uwyn.com               7170 Manage, Belgium
gbevin[remove] at uwyn dot com    Tel +32 64 84 80 03

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net




Re: What Template is CreateTable.getSql() Looking For?

by JR Boyens :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi! Welcome to the list.

So are you trying to extract the database functionality? Or is this using all of RIFE as the RIFE jar?

If you are using a release version of RIFE this should never happen as long as the RIFE jar is correctly placed in your classpath. If you built the jar yourself this could be a problem with the build script. If you're trying to extract the db functionalities then you need the templates in the classpath.

The SQL templates are found here:
    http://rifers.org:8088/viewrep/rifers/rife/trunk/src/templates/sql

But just downloading those isn't really the best way to go about things. I'm interested to hear what you are doing with RIFE so that I can better help resolve the issue.

Thanks,
JR

On 11/1/05, David Medinets <david.medinets@...> wrote:
Hi. I'm trying to get a message to Geert Bevin about RIFE. I'm trying
to use the CreateTable.getSql() method but it is complaining that a
template file is not available. Is there an example of this template?

Hi. I would like to use the CreateTable class in RIFE to generate the
CREATE TABLE Sql statements for my application. However, I am running
into a problem.

Here is the Java code that I am using:

        CreateTable create = new CreateTable(new Datasource());

        create.table("beer")
            .columns(Beer.class)
            .precision("brand", 50)
            .nullable("brand", CreateTable.NOTNULL);

        System.out.println (create.getSql());

When I execute this code, I get the following error:

Exception in thread "main"
com.uwyn.rife.template.exceptions.TemplateNotFoundException: Couldn't
find template 'sql.null.create_table '.
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:418)
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:365)
        at com.uwyn.rife.database.queries.CreateTable.getSql (CreateTable.java:128)
        at org.affy.play.PlayCreateTable.doIt(PlayCreateTable.java:22)
        at org.affy.play.PlayCreateTable.main(PlayCreateTable.java:30)
Caused by: java.lang.ClassNotFoundException: Couldn't resolve
template: 'com.uwyn.rife.template.sql.sql.null.create_table'.

I assume this template is sought by the following line of code in
CreateTable.getSql():

  Template template =
TemplateFactory.SQL.get("sql."+StringUtils.encodeClassname( mDatasource.getAliasedDriver())+".create_table");


What template is RIFE looking for? Is there an example that I can see?

thanks,
david
_______________________________________________
Rife-devel mailing list
Rife-devel@...
http://www.uwyn.com/mailman/listinfo/rife-devel



--
JR Boyens
jboyens@...

Re: What Template is CreateTable.getSql() Looking For?

by JR Boyens :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Please ignore this message then. I missed the real problem. :P

Thanks Geert.

On 11/1/05, JR Boyens <jboyens@...> wrote:
Hi! Welcome to the list.

So are you trying to extract the database functionality? Or is this using all of RIFE as the RIFE jar?

If you are using a release version of RIFE this should never happen as long as the RIFE jar is correctly placed in your classpath. If you built the jar yourself this could be a problem with the build script. If you're trying to extract the db functionalities then you need the templates in the classpath.

The SQL templates are found here:
    http://rifers.org:8088/viewrep/rifers/rife/trunk/src/templates/sql

But just downloading those isn't really the best way to go about things. I'm interested to hear what you are doing with RIFE so that I can better help resolve the issue.

Thanks,
JR


On 11/1/05, David Medinets <david.medinets@...> wrote:
Hi. I'm trying to get a message to Geert Bevin about RIFE. I'm trying
to use the CreateTable.getSql() method but it is complaining that a
template file is not available. Is there an example of this template?

Hi. I would like to use the CreateTable class in RIFE to generate the
CREATE TABLE Sql statements for my application. However, I am running
into a problem.

Here is the Java code that I am using:

        CreateTable create = new CreateTable(new Datasource());

        create.table("beer")
            .columns(Beer.class)
            .precision("brand", 50)
            .nullable("brand", CreateTable.NOTNULL);

        System.out.println (create.getSql());

When I execute this code, I get the following error:

Exception in thread "main"
com.uwyn.rife.template.exceptions.TemplateNotFoundException: Couldn't
find template 'sql.null.create_table '.
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:418)
        at com.uwyn.rife.template.TemplateFactory.get(TemplateFactory.java:365)
        at com.uwyn.rife.database.queries.CreateTable.getSql (CreateTable.java:128)
        at org.affy.play.PlayCreateTable.doIt(PlayCreateTable.java:22)
        at org.affy.play.PlayCreateTable.main(PlayCreateTable.java:30)
Caused by: java.lang.ClassNotFoundException: Couldn't resolve
template: 'com.uwyn.rife.template.sql.sql.null.create_table'.

I assume this template is sought by the following line of code in
CreateTable.getSql():

  Template template =
TemplateFactory.SQL.get("sql."+StringUtils.encodeClassname( mDatasource.getAliasedDriver())+".create_table");


What template is RIFE looking for? Is there an example that I can see?

thanks,
david
_______________________________________________
Rife-devel mailing list
Rife-devel@...
http://www.uwyn.com/mailman/listinfo/rife-devel



--
JR Boyens
jboyens@...



--
JR Boyens
jboyens@...
 
 
 
Google
rifers.org web