Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

There is a problem with the association of different packages #16

Open
kenchan0130 opened this issue Nov 17, 2017 · 1 comment
Open

Comments

@kenchan0130
Copy link
Member

kenchan0130 commented Nov 17, 2017

JdbcDriver: org.mariadb.jdbc.Driver 2.0.3
Database: mariadb 10.1.22
reladomo-scala-twitter-6.43-common: 16.5.4
reladomo-scala-common: 16.5.4

Expected behavior

I expect that the package will be imported in the generated scala code even if the package is different.

Actual behavior

If I prepare an xml containing the Relationship of different packages attribute, a class of the Relationship is not imported in the generated scala code.

Steps to reproduce the behavior

<!-- UserSchema.xml -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<MithraObject objectType="transactional"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="reladomoobject.xsd">

    <PackageName>com.example.reladomo.user.dao.generated_dao</PackageName>
    <ClassName>UserSchema</ClassName>
    <DefaultTable>user</DefaultTable>

    <AsOfAttribute name="processingDate" fromColumnName="in_z" toColumnName="out_z"
                   toIsInclusive="false"
                   isProcessingDate="true"
                   timezoneConversion="convert-to-database-timezone"
                   infinityDate="[com.gs.fw.common.mithra.util.DefaultInfinityTimestamp.getDefaultInfinity()]"
                   defaultIfNotSpecified="[com.gs.fw.common.mithra.util.DefaultInfinityTimestamp.getDefaultInfinity()]" />

    <Attribute name="id" javaType="long" columnName="id" primaryKey="true" primaryKeyGeneratorStrategy="Max"/>
    <Attribute name="name" javaType="String" columnName="name" nullable="false"/>

    <Relationship name="email" relatedObject="EmailSchema" cardinality="one-to-one">
      this.id = EmailSchema.userId
    </Relationship>
</MithraObject>
<!-- EmailSchema.xml -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<MithraObject objectType="transactional"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="reladomoobject.xsd">

    <PackageName>com.example.reladomo.email.dao.generated_dao</PackageName>
    <ClassName>EmailSchema</ClassName>
    <DefaultTable>email</DefaultTable>

    <AsOfAttribute name="processingDate" fromColumnName="in_z" toColumnName="out_z"
                   toIsInclusive="false"
                   isProcessingDate="true"
                   timezoneConversion="convert-to-database-timezone"
                   infinityDate="[com.gs.fw.common.mithra.util.DefaultInfinityTimestamp.getDefaultInfinity()]"
                   defaultIfNotSpecified="[com.gs.fw.common.mithra.util.DefaultInfinityTimestamp.getDefaultInfinity()]" />

    <Attribute name="id" javaType="long" columnName="id" primaryKey="true" primaryKeyGeneratorStrategy="Max"/>
    <Attribute name="userId" javaType="long" columnName="user_id" nullable="false"/>
    <Attribute name="encryptedEmail" javaType="byte[]" columnName="encrypted_email" nullable="false"/>

    <Relationship name="user" relatedObject="UserSchema" cardinality="one-to-one">
      this.userId = UserSchema.id
    </Relationship>
</MithraObject>

Workaround

Specify the same package to PackageName with xml.

@seratch
Copy link
Contributor

seratch commented Nov 20, 2017

As you mentioned, reladomo-scala doesn't allow having multiple packages so far. It won't take long to implement the feature (just modifying the scala code generator should be enough).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants