小编Man*_*ann的帖子

Hibernate Annotations不适用于getter但适用于属性

我面临着hibernate注释的问题.对于下面显示的代码,我有一个酒店类,客户类,我使用customerhotelbooking来跟踪哪个客户预订了哪个酒店,反之亦然.但是当我在酒店和顾客的吸气剂上放置注释时,它给出了一个例外,令人惊讶的是,当我将它放在属性上时它会起作用.有人可以告诉为什么会如此?

`Caused by: org.hibernate.MappingException: Could not determine type for: com.xebia.hotelBooking.domain.Customer, at table: CustomerHotelBooking, for columns: [org.hibernate.mapping.Column(customer)]
 at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:290)
 at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:274)
 at org.hibernate.mapping.Property.isValid(Property.java:217)
 at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)
 at org.hibernate.mapping.RootClass.validate(RootClass.java:236)
 at org.hibernate.cfg.Configuration.validate(Configuration.java:1193)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1378)
 at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
 at org.jboss.seam.persistence.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:165)
 at org.jboss.seam.persistence.HibernateSessionFactory.startup(HibernateSessionFactory.java:79)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
 at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
 at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
 at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
 at org.jboss.seam.Component.newInstance(Component.java:2132)`
Run Code Online (Sandbox Code Playgroud)

我有酒吧豆,如图所示`

@Id
 @GeneratedValue
 private int id;

 private String description;

 private String city;

 private String name;

 private String rating ;

 private int isBooked; 
 `
Run Code Online (Sandbox Code Playgroud)

Cusomer豆为`

        @Id …
Run Code Online (Sandbox Code Playgroud)

java orm hibernate

5
推荐指数
1
解决办法
2841
查看次数

Java命令模式与iPhone代表模式

嗨,我是一名java开发人员,这些天我也开始从事iphone开发.我想知道Java的命令模式有点类似于iphone中的委托模式,反之亦然,因为两者都有其他人在为受让人工作.有人可以启发我这个吗?

java design-patterns cocoa-design-patterns ios4

5
推荐指数
1
解决办法
1081
查看次数

UILocalNotification userInfo未序列化NSURL

我想做

UILocalNotification *notification = [[UILocalNotification alloc] init];
NSURL *urlForSomeObject=[[(NSManagedObject *)someObject objectID] URIRepresentation];
notification.fireDate  = aDate;
notification.timeZone  = [NSTimeZone systemTimeZone];
notification.soundName = UILocalNotificationDefaultSoundName;
notification.applicationIconBadgeNumber = 1;
notification.userInfo=[NSDictionary  dictionaryWithObject:urlForSomeObject            forKey:@"objectUrl"];
Run Code Online (Sandbox Code Playgroud)

当通知发生时,app给出了unable to serialize userInfo: (null)' 我检查过的异常 [NSDictionary dictionaryWithObject:urlForSomeObject forKey:@"objectUrl"]返回一个有效的字典.为什么会出现这种情况.到目前为止,我知道NSURL遵守NSCoding协议并且应该被序列化.有人可以帮帮我吗?

iphone ios4

1
推荐指数
1
解决办法
2742
查看次数