Hi
ScheduleEventImpl using following properties
private String id;
private String title;
private Date startDate;
private Date endDate;
is it possible to implement a entity class using Long id instead of String id
Any clue?
thanks
id for ScheduleEvent
-
- Posts: 56
- Joined: 19 Oct 2009, 15:56
Maybe it would be sufficient for you to wrap a Long id, like:
?
Code: Select all
private Long myId;
public Long getMyId() {
...
}
public String getId() {
if (myId == null)
return null;
else
return myId.toString();
}
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
jsfcoder, any particular reason you want it to be a long. It is used internally and generated so you don't need to care about it.
Hi Rene,
Good idea. Thanks for your advice! I will try it out.
Hi Cagatay,
I'm using seam 2.1.2 with seam application framework.
calendarEvent.java
entity class is like following normally:
@Id @GeneratedValue
private Long id;
private String title;
private Date startDate;
private Date endDate;
private String content;
private String remarks;
which id will map to database as a primary key, will be referenced by other table as foreign key, I never try using String as id .
seam application framework have some functions like
getId()
setId(Object id)
assignId(Object id)
any advise? thanks
Good idea. Thanks for your advice! I will try it out.
Hi Cagatay,
I'm using seam 2.1.2 with seam application framework.
calendarEvent.java
entity class is like following normally:
@Id @GeneratedValue
private Long id;
private String title;
private Date startDate;
private Date endDate;
private String content;
private String remarks;
which id will map to database as a primary key, will be referenced by other table as foreign key, I never try using String as id .
seam application framework have some functions like
getId()
setId(Object id)
assignId(Object id)
any advise? thanks
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Does your calendarEvent implement PrimeFaces ScheduleEvent?
@Name("calendarEvent')
public class CalendarEvent implements ScheduleEvent {
@Id @GeneratedValue
private String id;
private String title;
private Date startDate;
private Date endDate;
private String content;
private String remarks;
private boolean allDay = true;
private String styleClass;
private Object data;
getter setter ....
}
maybe this way looks better ...
public class CalendarEvent implements ScheduleEvent {
@Id @GeneratedValue
private String id;
private String title;
private Date startDate;
private Date endDate;
private String content;
private String remarks;
private boolean allDay = true;
private String styleClass;
private Object data;
getter setter ....
}
maybe this way looks better ...
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
I think it'd be better if you can use another property for database id, ScheduleEvent's id is the identifier in scheduleModel which PrimeFaces generates. So I'd go with the following;
Code: Select all
@Entity
public class CalendarEvent implements ScheduleEvent {
@Id @GeneratedValue
private Long dbId;
@Transient
private String id;
private String title;
private Date startDate;
private Date endDate;
private String content;
private String remarks;
private boolean allDay = true;
private String styleClass;
private Object data;
getter setter ....
}
few new problems encounter
1) JPA1 do not support persist
private Object data;
resolve by separate entity class and scheduleEventImpl object.
and then extend ScheduleEventImpl to add-in more properties, like following
private String id;
private String title;
private Date startDate;
private Date endDate;
private boolean allDay = true;
private String styleClass;
private Object data;
private Long dbId;
private String content;
private String remarks;
display events in scheduler, no problem.
have difficult to update event,
as
p:schedule eventSelectListener is looking for ScheduleEntrySelectEvent,
ScheduleEntrySelectEvent looking for ScheduleEvent
is any work around to ? to extend ScheduleEvent to ExtendScheduleEvent
thanks
1) JPA1 do not support persist
private Object data;
resolve by separate entity class and scheduleEventImpl object.
and then extend ScheduleEventImpl to add-in more properties, like following
private String id;
private String title;
private Date startDate;
private Date endDate;
private boolean allDay = true;
private String styleClass;
private Object data;
private Long dbId;
private String content;
private String remarks;
display events in scheduler, no problem.
have difficult to update event,
as
p:schedule eventSelectListener is looking for ScheduleEntrySelectEvent,
ScheduleEntrySelectEvent looking for ScheduleEvent
is any work around to ? to extend ScheduleEvent to ExtendScheduleEvent
thanks