You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by "Chohan, Dharmesh" <dh...@atos.net> on 2014/02/05 12:14:43 UTC

Domain create table issue

Hi

I have added a new domain as below and when I check the output it does not create the table for that domain.  The problem comes when installing the fixture and running the command isisJdoSupport.executeUpdate("delete from \"TopUpAmount\"")

@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE)
@javax.jdo.annotations.DatastoreIdentity(
        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column="id")
@javax.jdo.annotations.Version(
        strategy=VersionStrategy.VERSION_NUMBER, column="version")

@javax.jdo.annotations.Queries({
    @javax.jdo.annotations.Query(
            name="getTopupAmountsByCardId", language="JDOQL",
            value="SELECT "
                    + "FROM org.atos.tfgm.domains.TopUpAmount "
                    + "WHERE cardId.matches(:givenCardId) "),
    @javax.jdo.annotations.Query(
            name="getAmountsByCardId", language="JDOQL",
            value="SELECT amount "
                    + "FROM org.atos.tfgm.domains.TopUpAmount "
                    + "WHERE cardId.matches(:givenCardId) ")
})

@DescribedAs("To calculate and return a list of the Top Up Amounts "
                + "allowed for the supplied Card ID")
@ObjectType("TopUp Amount")
@Bookmarkable
public class TopUpAmount implements Comparable<TopUpAmount> { .... }


For all other domains ISIS creates a table for them.


Any ideas.

Thanks
Dharmesh





Re: Domain create table issue

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 5 February 2014 13:47, Chohan, Dharmesh <dh...@atos.net> wrote:

> Hi Dan
>
> I could not see the CREATE TABLE for the domain in the logging.
>

OK.

Although DataNucleus will lazily create tables on first use, we've found a
few issues with that if subtypes of classes are only discovered lazily.  So
we find it a good idea to force the creation of all entities.

The website explains how to do this [1].  Do you have this configuration?



>
> The application works fine, the error was produced when installing the
> fixture from wicket viewer Prototyping->Install fixtures.  The error was
> caused by calling the isisJdoSupport.executeUpdate("delete from
>  \"TopUpAmount\"")
>
>

> I have removed the line isisJdoSupport.executeUpdate("delete from
>  \"TopUpAmount\"") and now it does not throw the error.  It seems the table
> is created on first use of the domain.
>
> OK... understood... the table didn't exist because it was lazily created,
but the fixture you were running eagerly expected it to be there.

In which case the RegisterEntities should sort things out.

Cheers
Dan




> Regards
> Dharmesh
>
>

[1]
https://isis.apache.org/components/objectstores/jdo/eagerly-registering-entities.html



> -----Original Message-----
> From: Dan Haywood [mailto:dan@haywood-associates.co.uk]
> Sent: Wednesday, February 05, 2014 12:33 PM
> To: users
> Subject: Re: Domain create table issue
>
> On 5 February 2014 11:14, Chohan, Dharmesh <dh...@atos.net>
> wrote:
>
> > Hi
> >
> > I have added a new domain as below and when I check the output it does
> > not create the table for that domain.  The problem comes when
> > installing the fixture and running the command
> > isisJdoSupport.executeUpdate("delete from
> > \"TopUpAmount\"")
> >
>
> I don't quite follow this.
>
> Do you see the 'CREATE TABLE' statement in the logging?  If so, then we
> know that the JDO/DN annotations are correct.
>
>
> To confirm, if you comment out the fixture setup, does Isis boot up ok?
>
> If it does, then check the output; I'm guessing that there might be an
> issue with the table name; that could be dependent on the JDBC driver you
> are dependent on.  Postgres requires the double quotes to be escaped,
> others support [square brackets] etc.
>
>
>
> >
> > [snip]
> > @ObjectType("TopUp Amount")
> > @Bookmarkable
> > public class TopUpAmount implements Comparable<TopUpAmount> { .... }
> >
> >
> >
> ~~~
> Also, not sure if it's your issue, but there shouldn't be a space in the
> @ObjectType value.  That gets used internally to create the OID of the
> object, and could be causing a problem later on
>
> Let us know
>
> Dan
>
>
>
>
> > For all other domains ISIS creates a table for them.
> >
> >
> > Any ideas.
> >
> > Thanks
> > Dharmesh
> >
> >
> >
> >
> >
>

RE: Domain create table issue

Posted by "Chohan, Dharmesh" <dh...@atos.net>.
Hi Dan

I could not see the CREATE TABLE for the domain in the logging.

The application works fine, the error was produced when installing the fixture from wicket viewer Prototyping->Install fixtures.  The error was caused by calling the isisJdoSupport.executeUpdate("delete from  \"TopUpAmount\"")

I have removed the line isisJdoSupport.executeUpdate("delete from  \"TopUpAmount\"") and now it does not throw the error.  It seems the table is created on first use of the domain.

Regards
Dharmesh

-----Original Message-----
From: Dan Haywood [mailto:dan@haywood-associates.co.uk] 
Sent: Wednesday, February 05, 2014 12:33 PM
To: users
Subject: Re: Domain create table issue

On 5 February 2014 11:14, Chohan, Dharmesh <dh...@atos.net> wrote:

> Hi
>
> I have added a new domain as below and when I check the output it does 
> not create the table for that domain.  The problem comes when 
> installing the fixture and running the command 
> isisJdoSupport.executeUpdate("delete from
> \"TopUpAmount\"")
>

I don't quite follow this.

Do you see the 'CREATE TABLE' statement in the logging?  If so, then we know that the JDO/DN annotations are correct.


To confirm, if you comment out the fixture setup, does Isis boot up ok?

If it does, then check the output; I'm guessing that there might be an issue with the table name; that could be dependent on the JDBC driver you are dependent on.  Postgres requires the double quotes to be escaped, others support [square brackets] etc.



>
> [snip]
> @ObjectType("TopUp Amount")
> @Bookmarkable
> public class TopUpAmount implements Comparable<TopUpAmount> { .... }
>
>
>
~~~
Also, not sure if it's your issue, but there shouldn't be a space in the @ObjectType value.  That gets used internally to create the OID of the object, and could be causing a problem later on

Let us know

Dan




> For all other domains ISIS creates a table for them.
>
>
> Any ideas.
>
> Thanks
> Dharmesh
>
>
>
>
>

Re: Domain create table issue

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 5 February 2014 11:14, Chohan, Dharmesh <dh...@atos.net> wrote:

> Hi
>
> I have added a new domain as below and when I check the output it does not
> create the table for that domain.  The problem comes when installing the
> fixture and running the command isisJdoSupport.executeUpdate("delete from
> \"TopUpAmount\"")
>

I don't quite follow this.

Do you see the 'CREATE TABLE' statement in the logging?  If so, then we
know that the JDO/DN annotations are correct.


To confirm, if you comment out the fixture setup, does Isis boot up ok?

If it does, then check the output; I'm guessing that there might be an
issue with the table name; that could be dependent on the JDBC driver you
are dependent on.  Postgres requires the double quotes to be escaped,
others support [square brackets] etc.



>
> [snip]
> @ObjectType("TopUp Amount")
> @Bookmarkable
> public class TopUpAmount implements Comparable<TopUpAmount> { .... }
>
>
>
~~~
Also, not sure if it's your issue, but there shouldn't be a space in the
@ObjectType value.  That gets used internally to create the OID of the
object, and could be causing a problem later on

Let us know

Dan




> For all other domains ISIS creates a table for them.
>
>
> Any ideas.
>
> Thanks
> Dharmesh
>
>
>
>
>