Re: [Stripes-users] form with an embedded id

2016-04-18 Thread Joaquin Valdez
Thanks Rick.  Once I escaped the “|” all worked just fine.  Thanks for the idea 
and help.

   String[] dates = combinedId.split( “\\|" );

Joaquin Valdez
joaquinfval...@gmail.com

> On Apr 16, 2016, at 12:37 PM, Rick Grashel  wrote:
> 
> Joaquin,
> 
> Is this a PK for a domain object?  The domain object is called 
> "FreeShippings"?  If so, add the following two methods like the following to 
> your PK class.  (I have put brute force code here.  You should probably do 
> error-checking) :
> 
> public String getCombinedId() {
>return this.startDate.getTime() + "|" + this.endDate.getTime();
> }
> 
> // This presumes a delimiter of pipe
> public String setCombinedId( String combinedId ) {
>String[] dates = combinedId.split( "|" );
>this.startDate = new Date( Long.parseLong( dates[ 0 ] ) );
>this.endDate = new Date( Long.parseLong( dates[ 1 ] ) );
> }
> 
> Then, in your form, you do this:
> 
>  value=${actionBean.freeShippingsPK.combinedId}"/>
> 
> If you want, you can also use a TypeConverter to do domain object loading and 
> manipulation.
> 
> When I am dealing with composite primary keys, I almost always have a pseudo 
> single-field setter/getter for convenience and Type conversion.
> 
> -- Rick
> 
> 
> On Sat, Apr 16, 2016 at 1:16 PM, Joaquin Valdez  > wrote:
> Thanks Rick!
> 
> The model class I am using doesn’t contain a field called ID as the key.  I 
> wish it did.
> 
> Here is a snippet from the model :
> 
> 
> @Entity
> public class FreeShippings implements Serializable {
> 
> private static final long serialVersionUID = 1L;
>   
>@EmbeddedId
> protected FreeShippingsPK freeShippingsPK;
> ……
> }
>  
> 
> Where FreeShippingsPK is defined as:
> 
> @Embeddable
> public class FreeShippingsPK implements Serializable {
> 
> @Basic(optional = false)
> @NotNull
> @Column(name = "StartDate")
> @Temporal(TemporalType.TIMESTAMP)
> private Date startDate;
> 
> @Basic(optional = false)
> @NotNull
> @Column(name = "EndDate")
> @Temporal(TemporalType.TIMESTAMP)
> private Date endDate;
> 
>// getters and setters...
> }
> 
> How would I reference this type of Primary key in the hiddent INPUT tag?
> 
> Thanks!
> 
> Joaquin Valdez
> joaquinfval...@gmail.com 
> 
>> On Apr 16, 2016, at 11:55 AM, Rick Grashel > > wrote:
>> 
>> Hi Joaquin,
>> 
>> If the ID of the user (being edited?) is already known, you can just use a 
>> regular  tag.  No need to use a  tag.  So like this:
>> 
>> http://actionbean.user.id/>}"/>
>> 
>> This presumes that you have a type converter you are using which will load 
>> the user object when the parameters.  My experience with  tags has 
>> been varied.  Sometimes it seems to work and in other situations it does not 
>> behave as expected.  So in situations like the one you described, I will 
>> generally stick with a regular  tag.
>> 
>> -- Rick
>> 
>> On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez > > wrote:
>> Hello!
>> 
>> I am trying to build a form for a table containing records that has an 
>> embedded Primary Key.  How is that done?  Typically I just do this in the 
>> form tag:
>> 
>> 
>>  
>>  ….
>> 
>> 
>> Currently I have it set up as I mentioned and when I try to retrieve the 
>> user record, it comes back NULL.
>> 
>> Thanks!
>> Joaquin Valdez
>> joaquinfval...@gmail.com 
>> 
>> 
>> --
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z 
>> 
>> ___
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net 
>> 
>> https://lists.sourceforge.net/lists/listinfo/stripes-users 
>> 
>> 
>> 
>> --
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
>>  
>> 
>> 

Re: [Stripes-users] form with an embedded id

2016-04-16 Thread Joaquin Valdez
Thanks! I will try that.  I had thought of doing just that, but wanted to see 
if there was another way.  

Joaquin

> On Apr 16, 2016, at 12:37 PM, Rick Grashel  wrote:
> 
> Joaquin,
> 
> Is this a PK for a domain object?  The domain object is called 
> "FreeShippings"?  If so, add the following two methods like the following to 
> your PK class.  (I have put brute force code here.  You should probably do 
> error-checking) :
> 
> public String getCombinedId() {
>return this.startDate.getTime() + "|" + this.endDate.getTime();
> }
> 
> // This presumes a delimiter of pipe
> public String setCombinedId( String combinedId ) {
>String[] dates = combinedId.split( "|" );
>this.startDate = new Date( Long.parseLong( dates[ 0 ] ) );
>this.endDate = new Date( Long.parseLong( dates[ 1 ] ) );
> }
> 
> Then, in your form, you do this:
> 
>  value=${actionBean.freeShippingsPK.combinedId}"/>
> 
> If you want, you can also use a TypeConverter to do domain object loading and 
> manipulation.
> 
> When I am dealing with composite primary keys, I almost always have a pseudo 
> single-field setter/getter for convenience and Type conversion.
> 
> -- Rick
> 
> 
>> On Sat, Apr 16, 2016 at 1:16 PM, Joaquin Valdez  
>> wrote:
>> Thanks Rick!
>> 
>> The model class I am using doesn’t contain a field called ID as the key.  I 
>> wish it did.
>> 
>> Here is a snippet from the model :
>> 
>> 
>> @Entity
>> public class FreeShippings implements Serializable {
>> 
>> private static final long serialVersionUID = 1L;
>>   
>>@EmbeddedId
>> protected FreeShippingsPK freeShippingsPK;
>> ……
>> }
>>  
>> 
>> Where FreeShippingsPK is defined as:
>> 
>> @Embeddable
>> public class FreeShippingsPK implements Serializable {
>> 
>> @Basic(optional = false)
>> @NotNull
>> @Column(name = "StartDate")
>> @Temporal(TemporalType.TIMESTAMP)
>> private Date startDate;
>> 
>> @Basic(optional = false)
>> @NotNull
>> @Column(name = "EndDate")
>> @Temporal(TemporalType.TIMESTAMP)
>> private Date endDate;
>> 
>>// getters and setters...
>> }
>> 
>> How would I reference this type of Primary key in the hiddent INPUT tag?
>> 
>> Thanks!
>> 
>> Joaquin Valdez
>> joaquinfval...@gmail.com
>> 
>>> On Apr 16, 2016, at 11:55 AM, Rick Grashel  wrote:
>>> 
>>> Hi Joaquin,
>>> 
>>> If the ID of the user (being edited?) is already known, you can just use a 
>>> regular  tag.  No need to use a  tag.  So like this:
>>> 
>>> 
>>> 
>>> This presumes that you have a type converter you are using which will load 
>>> the user object when the parameters.  My experience with  tags has 
>>> been varied.  Sometimes it seems to work and in other situations it does 
>>> not behave as expected.  So in situations like the one you described, I 
>>> will generally stick with a regular  tag.
>>> 
>>> -- Rick
>>> 
 On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez 
  wrote:
 Hello!
 
 I am trying to build a form for a table containing records that has an 
 embedded Primary Key.  How is that done?  Typically I just do this in the 
 form tag:
 
 

….
 
 
 Currently I have it set up as I mentioned and when I try to retrieve the 
 user record, it comes back NULL.
 
 Thanks!
 Joaquin Valdez
 joaquinfval...@gmail.com
 
 
 --
 Find and fix application performance issues faster with Applications 
 Manager
 Applications Manager provides deep performance insights into multiple 
 tiers of
 your business applications. It resolves application problems quickly and
 reduces your MTTR. Get your free trial!
 https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
>>> 
>>> --
>>> Find and fix application performance issues faster with Applications Manager
>>> Applications Manager provides deep performance insights into multiple tiers 
>>> of
>>> your business applications. It resolves application problems quickly and
>>> reduces your MTTR. Get your free trial!
>>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
>>> Stripes-users mailing list
>>> Stripes-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>> 
>> 
>> --
>> Find and fix application performance issues faster with Applications Manager
>> Applications Manager provides deep performance insights into multiple tiers 
>> of
>> your business applications. It 

Re: [Stripes-users] form with an embedded id

2016-04-16 Thread Rick Grashel
Joaquin,

Is this a PK for a domain object?  The domain object is called
"FreeShippings"?  If so, add the following two methods like the following
to your PK class.  (I have put brute force code here.  You should probably
do error-checking) :

public String getCombinedId() {
   return this.startDate.getTime() + "|" + this.endDate.getTime();
}

// This presumes a delimiter of pipe
public String setCombinedId( String combinedId ) {
   String[] dates = combinedId.split( "|" );
   this.startDate = new Date( Long.parseLong( dates[ 0 ] ) );
   this.endDate = new Date( Long.parseLong( dates[ 1 ] ) );
}

Then, in your form, you do this:



If you want, you can also use a TypeConverter to do domain object loading
and manipulation.

When I am dealing with composite primary keys, I almost always have a
pseudo single-field setter/getter for convenience and Type conversion.

-- Rick


On Sat, Apr 16, 2016 at 1:16 PM, Joaquin Valdez 
wrote:

> Thanks Rick!
>
> The model class I am using doesn’t contain a field called ID as the key.
> I wish it did.
>
> Here is a snippet from the model :
>
>
> @Entity
> public class FreeShippings implements Serializable {
>
> private static final long serialVersionUID = 1L;
>
> *   @EmbeddedId*
> *protected FreeShippingsPK freeShippingsPK;*
> ……
> }
>
>
> Where FreeShippingsPK is defined as:
>
> @Embeddable
> public class FreeShippingsPK implements Serializable {
>
> @Basic(optional = false)
> @NotNull
> @Column(name = "StartDate")
> @Temporal(TemporalType.TIMESTAMP)
> private Date startDate;
>
> @Basic(optional = false)
> @NotNull
> @Column(name = "EndDate")
> @Temporal(TemporalType.TIMESTAMP)
> private Date endDate;
>
>// getters and setters...
> }
>
> How would I reference this type of Primary key in the hiddent INPUT tag?
>
> Thanks!
>
> Joaquin Valdez
> joaquinfval...@gmail.com
>
> On Apr 16, 2016, at 11:55 AM, Rick Grashel  wrote:
>
> Hi Joaquin,
>
> If the ID of the user (being edited?) is already known, you can just use a
> regular  tag.  No need to use a  tag.  So like this:
>
> http://actionbean.user.id/>}"/>
>
> This presumes that you have a type converter you are using which will load
> the user object when the parameters.  My experience with  tags has
> been varied.  Sometimes it seems to work and in other situations it does
> not behave as expected.  So in situations like the one you described, I
> will generally stick with a regular  tag.
>
> -- Rick
>
> On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez  > wrote:
>
>> Hello!
>>
>> I am trying to build a form for a table containing records that has an
>> embedded Primary Key.  How is that done?  Typically I just do this in the
>> form tag:
>>
>> 
>> 
>> ….
>> 
>>
>> Currently I have it set up as I mentioned and when I try to retrieve the
>> user record, it comes back NULL.
>>
>> Thanks!
>> Joaquin Valdez
>> joaquinfval...@gmail.com
>>
>>
>>
>> --
>> Find and fix application performance issues faster with Applications
>> Manager
>> Applications Manager provides deep performance insights into multiple
>> tiers of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> ___
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
> --
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
>
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
>
>
> --
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Find and fix application performance issues faster with Applications Manager

Re: [Stripes-users] form with an embedded id

2016-04-16 Thread Joaquin Valdez
Thanks Rick!

The model class I am using doesn’t contain a field called ID as the key.  I 
wish it did.

Here is a snippet from the model :


@Entity
public class FreeShippings implements Serializable {

private static final long serialVersionUID = 1L;
  
   @EmbeddedId
protected FreeShippingsPK freeShippingsPK;
……
}
 

Where FreeShippingsPK is defined as:

@Embeddable
public class FreeShippingsPK implements Serializable {

@Basic(optional = false)
@NotNull
@Column(name = "StartDate")
@Temporal(TemporalType.TIMESTAMP)
private Date startDate;

@Basic(optional = false)
@NotNull
@Column(name = "EndDate")
@Temporal(TemporalType.TIMESTAMP)
private Date endDate;

   // getters and setters...
}

How would I reference this type of Primary key in the hiddent INPUT tag?

Thanks!

Joaquin Valdez
joaquinfval...@gmail.com

> On Apr 16, 2016, at 11:55 AM, Rick Grashel  wrote:
> 
> Hi Joaquin,
> 
> If the ID of the user (being edited?) is already known, you can just use a 
> regular  tag.  No need to use a  tag.  So like this:
> 
> http://actionbean.user.id/>}"/>
> 
> This presumes that you have a type converter you are using which will load 
> the user object when the parameters.  My experience with  tags has 
> been varied.  Sometimes it seems to work and in other situations it does not 
> behave as expected.  So in situations like the one you described, I will 
> generally stick with a regular  tag.
> 
> -- Rick
> 
> On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez  > wrote:
> Hello!
> 
> I am trying to build a form for a table containing records that has an 
> embedded Primary Key.  How is that done?  Typically I just do this in the 
> form tag:
> 
> 
>   
>   ….
> 
> 
> Currently I have it set up as I mentioned and when I try to retrieve the user 
> record, it comes back NULL.
> 
> Thanks!
> Joaquin Valdez
> joaquinfval...@gmail.com 
> 
> 
> --
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z 
> 
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net 
> 
> https://lists.sourceforge.net/lists/listinfo/stripes-users 
> 
> 
> 
> --
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] form with an embedded id

2016-04-16 Thread Rick Grashel
Hi Joaquin,

If the ID of the user (being edited?) is already known, you can just use a
regular  tag.  No need to use a  tag.  So like this:



This presumes that you have a type converter you are using which will load
the user object when the parameters.  My experience with  tags has
been varied.  Sometimes it seems to work and in other situations it does
not behave as expected.  So in situations like the one you described, I
will generally stick with a regular  tag.

-- Rick

On Sat, Apr 16, 2016 at 12:49 PM, Joaquin Valdez 
wrote:

> Hello!
>
> I am trying to build a form for a table containing records that has an
> embedded Primary Key.  How is that done?  Typically I just do this in the
> form tag:
>
> 
> 
> ….
> 
>
> Currently I have it set up as I mentioned and when I try to retrieve the
> user record, it comes back NULL.
>
> Thanks!
> Joaquin Valdez
> joaquinfval...@gmail.com
>
>
>
> --
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users