You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Øyvind Harboe (JIRA)" <de...@cayenne.apache.org> on 2008/01/23 11:52:33 UTC

[JIRA] Created: (CAY-975) Add MergerToken to update database or model with PK Generation Strategy

Add MergerToken to update database or model with PK Generation Strategy
-----------------------------------------------------------------------

                 Key: CAY-975
                 URL: https://issues.apache.org/cayenne/browse/CAY-975
             Project: Cayenne
          Issue Type: Improvement
          Components: Cayenne Core Library
    Affects Versions: 3.0
            Reporter: Øyvind Harboe
            Assignee: Andrus Adamchik


I'm using DbMerger to update the DataMap with attributes from the database. This solves a raft of problems, including how to let database managers modify length of fields from e.g. SQL Manager(which they are comfortable with).

My DataMap states that the pk is generated by the database, but when that is not the case I'll get this exception:

Caused by: java.sql.SQLException: Cannot insert the value NULL into column 'user_id', table 'qpb.dbo.users'; column does not allow nulls. INSERT fails.
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)




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


[JIRA] Commented: (CAY-975) Add MergerToken to update database or model with PK Generation Strategy

Posted by "Øyvind Harboe (JIRA)" <de...@cayenne.apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713#action_12713 ] 

Øyvind Harboe commented on CAY-975:
-----------------------------------

Another way to address this would be to add an "autodetect" to PK Generation Strategy. Cayenne would then have to catch the exception and try to generate the pk instead. Yuk! Sounds icky. 

> Add MergerToken to update database or model with PK Generation Strategy
> -----------------------------------------------------------------------
>
>                 Key: CAY-975
>                 URL: https://issues.apache.org/cayenne/browse/CAY-975
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>            Reporter: Øyvind Harboe
>            Assignee: Andrus Adamchik
>
> I'm using DbMerger to update the DataMap with attributes from the database. This solves a raft of problems, including how to let database managers modify length of fields from e.g. SQL Manager(which they are comfortable with).
> My DataMap states that the pk is generated by the database, but when that is not the case I'll get this exception:
> Caused by: java.sql.SQLException: Cannot insert the value NULL into column 'user_id', table 'qpb.dbo.users'; column does not allow nulls. INSERT fails.
> 	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
> 	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
> 	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
> 	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
> 	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)

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


[JIRA] Commented: (CAY-975) Add MergerToken to update database or model with PK Generation Strategy

Posted by "Øyvind Harboe (JIRA)" <de...@cayenne.apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712#action_12712 ] 

Øyvind Harboe commented on CAY-975:
-----------------------------------

Is there a way to read out of the database where the pk is generated?

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/DatabaseMetaData.html#getPrimaryKeys(java.lang.String,%20java.lang.String,%20java.lang.String)



> Add MergerToken to update database or model with PK Generation Strategy
> -----------------------------------------------------------------------
>
>                 Key: CAY-975
>                 URL: https://issues.apache.org/cayenne/browse/CAY-975
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>            Reporter: Øyvind Harboe
>            Assignee: Andrus Adamchik
>
> I'm using DbMerger to update the DataMap with attributes from the database. This solves a raft of problems, including how to let database managers modify length of fields from e.g. SQL Manager(which they are comfortable with).
> My DataMap states that the pk is generated by the database, but when that is not the case I'll get this exception:
> Caused by: java.sql.SQLException: Cannot insert the value NULL into column 'user_id', table 'qpb.dbo.users'; column does not allow nulls. INSERT fails.
> 	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
> 	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
> 	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
> 	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
> 	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)

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


[JIRA] Assigned: (CAY-975) Add MergerToken to update database or model with PK Generation Strategy

Posted by "Tore Halset (JIRA)" <de...@cayenne.apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tore Halset reassigned CAY-975:
-------------------------------

    Assignee: Tore Halset  (was: Andrus Adamchik)

> Add MergerToken to update database or model with PK Generation Strategy
> -----------------------------------------------------------------------
>
>                 Key: CAY-975
>                 URL: https://issues.apache.org/cayenne/browse/CAY-975
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>            Reporter: Øyvind Harboe
>            Assignee: Tore Halset
>
> I'm using DbMerger to update the DataMap with attributes from the database. This solves a raft of problems, including how to let database managers modify length of fields from e.g. SQL Manager(which they are comfortable with).
> My DataMap states that the pk is generated by the database, but when that is not the case I'll get this exception:
> Caused by: java.sql.SQLException: Cannot insert the value NULL into column 'user_id', table 'qpb.dbo.users'; column does not allow nulls. INSERT fails.
> 	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
> 	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
> 	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
> 	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
> 	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)

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