You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fischer (JIRA)" <ji...@apache.org> on 2010/10/01 21:41:33 UTC

[jira] Created: (TORQUE-147) Database objects should not need to inherit from BaseObject

Database objects should not need to inherit from BaseObject
-----------------------------------------------------------

                 Key: TORQUE-147
                 URL: https://issues.apache.org/jira/browse/TORQUE-147
             Project: Torque
          Issue Type: Improvement
            Reporter: Thomas Fischer
            Assignee: Thomas Fischer


Currently it is an error if database objects do not inherit from BaseObject. This makes embedding of Torque objects in other frameworks very difficult, because it does not allow to choose an own parent to inherit from.

The minimum requirement would be that it is not required any more that database objects inherit from BaseObject.

Ideally BaseObject dies and the base objects inherit directly from java.lang.object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[jira] Commented: (TORQUE-147) Database objects should not need to inherit from BaseObject

Posted by "CG Monroe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TORQUE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917618#action_12917618 ] 

CG Monroe commented on TORQUE-147:
----------------------------------

I'm -1 on making this a global change.

I'm concerned about how you would do generic methods without BaseClass.  E.g.:

doSomethingBasedOnRecordType( BaseObject rec ) {

    <use introspection to determine action>
}

Yes, I guess you can do the same thing using an object type. But IMHO, having at least an Interface to limit objects to valid records is better for documentation and compile time error checking.

FWIW - I have a bunch of code that does just this.  Some of it does generic stuff with the assumption of  the presence of BaseObject methods in any record.

IMHO, while this is a nice way to migrate, it would add require too much existing code to be changed if we just dropped BaseObject all together.  

Having an interface seems like better middle ground.  

If integration with external frameworks is a requirement for a subset of Torque users, then perhaps this could be an generation time option.

Also, don't we handle a lot of this with the Beans generation options?  If you need to interface with another framework that deals with POJO objects, just create a bean and pass it around.  If the remote framework requires annotations, perhaps this is where that should happen.

> Database objects should not need to inherit from BaseObject
> -----------------------------------------------------------
>
>                 Key: TORQUE-147
>                 URL: https://issues.apache.org/jira/browse/TORQUE-147
>             Project: Torque
>          Issue Type: Improvement
>            Reporter: Thomas Fischer
>            Assignee: Thomas Fischer
>
> Currently it is an error if database objects do not inherit from BaseObject. This makes embedding of Torque objects in other frameworks very difficult, because it does not allow to choose an own parent to inherit from.
> The minimum requirement would be that it is not required any more that database objects inherit from BaseObject.
> Ideally BaseObject dies and the base objects inherit directly from java.lang.object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[jira] Commented: (TORQUE-147) Database objects should not need to inherit from BaseObject

Posted by "Thomas Fischer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TORQUE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917888#action_12917888 ] 

Thomas Fischer commented on TORQUE-147:
---------------------------------------

I should have been more clear before. The idea was to replace inheritance by implementing an interface. Intospection should really be the last option if everything else fails (but it will not be needed here IMO. If it will turns out it is needed, we need to discuss again)

As for the beans, while they rdo what they are supposed to do, it turns out that in a real project you need to do a lot of convedrsion from Beans to Databse objects and vice versa. Consider e.g. a classic 3-Tier application: A database layer, a business layer and a presentation layer. The service layer would use database objects internally but its external interfaces are beans. This works well as long as a service does not call other services, (which is a perfect sensible thing to do) because then the caller service must convert ts internal object to beans, call the other service and convert the beans back to database objects. It can be done (we have a production project using this technique) but it is a pain.
There might be good reasons for bean objects, but using beans as business objects is not  a good thing to do in my opinion.


> Database objects should not need to inherit from BaseObject
> -----------------------------------------------------------
>
>                 Key: TORQUE-147
>                 URL: https://issues.apache.org/jira/browse/TORQUE-147
>             Project: Torque
>          Issue Type: Improvement
>            Reporter: Thomas Fischer
>            Assignee: Thomas Fischer
>
> Currently it is an error if database objects do not inherit from BaseObject. This makes embedding of Torque objects in other frameworks very difficult, because it does not allow to choose an own parent to inherit from.
> The minimum requirement would be that it is not required any more that database objects inherit from BaseObject.
> Ideally BaseObject dies and the base objects inherit directly from java.lang.object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[jira] Commented: (TORQUE-147) Database objects should not need to inherit from BaseObject

Posted by "Christoph Engelbert (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TORQUE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917183#action_12917183 ] 

Christoph Engelbert commented on TORQUE-147:
--------------------------------------------

Personally I like the idea of removing inheritance to give the opinion of inheriting from other classes. If something is needed to recognize it as an legal Torque object it could be an marker interface or marker annotation.
But for me, if I'm not wrong, there's a problem about (at least) the Maven plugin which regenerates the BaseClasses on every build or do you guys want to remove that double-class concept at all?

> Database objects should not need to inherit from BaseObject
> -----------------------------------------------------------
>
>                 Key: TORQUE-147
>                 URL: https://issues.apache.org/jira/browse/TORQUE-147
>             Project: Torque
>          Issue Type: Improvement
>            Reporter: Thomas Fischer
>            Assignee: Thomas Fischer
>
> Currently it is an error if database objects do not inherit from BaseObject. This makes embedding of Torque objects in other frameworks very difficult, because it does not allow to choose an own parent to inherit from.
> The minimum requirement would be that it is not required any more that database objects inherit from BaseObject.
> Ideally BaseObject dies and the base objects inherit directly from java.lang.object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[jira] Commented: (TORQUE-147) Database objects should not need to inherit from BaseObject

Posted by "Thomas Fischer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TORQUE-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917215#action_12917215 ] 

Thomas Fischer commented on TORQUE-147:
---------------------------------------

No, there will still be BaseXXX and XXX for each table. Just the necessity that BaseXXX must inherit from BaseObject will be removed.

> Database objects should not need to inherit from BaseObject
> -----------------------------------------------------------
>
>                 Key: TORQUE-147
>                 URL: https://issues.apache.org/jira/browse/TORQUE-147
>             Project: Torque
>          Issue Type: Improvement
>            Reporter: Thomas Fischer
>            Assignee: Thomas Fischer
>
> Currently it is an error if database objects do not inherit from BaseObject. This makes embedding of Torque objects in other frameworks very difficult, because it does not allow to choose an own parent to inherit from.
> The minimum requirement would be that it is not required any more that database objects inherit from BaseObject.
> Ideally BaseObject dies and the base objects inherit directly from java.lang.object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org