You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Johannes <jo...@posteo.de> on 2016/02/20 07:43:33 UTC

userbased login data

Hello,

is it possible to avoid connection pooling and create dedicated database
connections on demand with login data entered by the user?

Best regards
Johannes



Re: inserting null columns

Posted by do...@xsinet.co.za.
Ah .... I see, so by explicitly setting null columns Cayenne ensures that 
the local object is in sync with the DB row.

Thanks, that makes sense :-)

Jurgen


-----Original Message----- 
From: Andrus Adamchik
Sent: Wednesday, February 24, 2016 10:16 AM
To: user@cayenne.apache.org
Subject: Re: inserting null columns

Hi Jurgen,

the reason for that behavior is that Cayenne knows nothing about the DB 
defaults, and insert that relies on them would end up with an object in 
memory whose state is different from the row in the DB. So your best bet is 
to use a "postAdd" callback method to init the defaults on the Java side.

Andrus


> On Feb 22, 2016, at 4:14 PM, dollj@xsinet.co.za wrote:
>
> Hi All
>
> I've notice that when Cayenne 3.1 constructs a SQL insert statement, that 
> it includes all null valued columns as well.
> Is there a way to prevent this from happening because in MS SQL it 
> prevents default column constraint values from being applied.
>
> I've tried creating an entity without fields for the columns that have DB 
> default values but Cayenne insists on adding the missing columns when 
> inserting !?
>
> Is there a particular reason for this behaviour ?
>
> Thanks, regards
> Jurgen
>


Re: inserting null columns

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Jurgen,

the reason for that behavior is that Cayenne knows nothing about the DB defaults, and insert that relies on them would end up with an object in memory whose state is different from the row in the DB. So your best bet is to use a "postAdd" callback method to init the defaults on the Java side.

Andrus


> On Feb 22, 2016, at 4:14 PM, dollj@xsinet.co.za wrote:
> 
> Hi All
> 
> I've notice that when Cayenne 3.1 constructs a SQL insert statement, that it includes all null valued columns as well.
> Is there a way to prevent this from happening because in MS SQL it prevents default column constraint values from being applied.
> 
> I've tried creating an entity without fields for the columns that have DB default values but Cayenne insists on adding the missing columns when inserting !?
> 
> Is there a particular reason for this behaviour ?
> 
> Thanks, regards
> Jurgen
> 


inserting null columns

Posted by do...@xsinet.co.za.
Hi All

I've notice that when Cayenne 3.1 constructs a SQL insert statement, that it 
includes all null valued columns as well.
Is there a way to prevent this from happening because in MS SQL it prevents 
default column constraint values from being applied.

I've tried creating an entity without fields for the columns that have DB 
default values but Cayenne insists on adding the missing columns when 
inserting !?

Is there a particular reason for this behaviour ?

Thanks, regards
Jurgen


Re: userbased login data

Posted by Andrus Adamchik <an...@objectstyle.org>.
Theoretically yes, but since Cayenne stack has a shared object, you need to make sure there are no conflicting IDs between the objects from multiple data stores. 

Perhaps your better bet is to use a separate ServerRuntime (with its own DataSource) per user?

Andrus


> On Feb 20, 2016, at 9:43 AM, Johannes <jo...@posteo.de> wrote:
> 
> Hello,
> 
> is it possible to avoid connection pooling and create dedicated database
> connections on demand with login data entered by the user?
> 
> Best regards
> Johannes
> 
>