0

In my Java Application creating Value Object(Java Bean) in that have one field

@Entity
@Table(name="EC_TIMETABLE")
    public class TimetableVO
{
----//@id and some other column and variables
----

private List<WeekdayType> repeatDays;//Their is No column in Database
------
------//setter and getter method
}

Hear WeekdayType is Enum class

public static enum WeekdayType {
    MONDAY(Calendar.MONDAY), TUESDAY(Calendar.TUESDAY), WEDNESDAY(
            Calendar.WEDNESDAY), THURSDAY(Calendar.THURSDAY), FRIDAY(
            Calendar.FRIDAY), SATURDAY(Calendar.SATURDAY), SUNDAY(
            Calendar.SUNDAY);

    private int day;

    private WeekdayType(int day) {
        this.day = day;
    }

I'm using TimetableVO getRepeatedDays() another class.

When i'm Start the Server i got error

org.hibernate.MappingException: Could not determine type for: java.util.List, at table: EC_TIMETABLE, for columns: [org.hibernate.mapping.Column(repeatDays)]

So is their any Column required in Database or Syntax Problem ..... Thank in advance..

Java Developer
  • 1,873
  • 8
  • 32
  • 63

3 Answers3

1

No, you need not have a column in database for this field if you do not want to.

You can mark it as transient by @Transient annotation if you do not want to make it persistent.

@Transient
private List<WeekdayType> repeatDays;
Rahul
  • 15,979
  • 4
  • 42
  • 63
0

Marking the collection as transient will instruct Hibernate that this is not a persisted item. I think something like this is more in line with what you require.

Community
  • 1
  • 1
Sean A
  • 31
  • 3
0

JPA's @Transient annotation is used to indicate that a field is not to be persisted in the database, i.e. their semantics are different.

Now the solution is ...

@Transient
private List<WeekdayType> repeatDays;
Java Developer
  • 1,873
  • 8
  • 32
  • 63