我正在使用 Orika 将我的 Hibernate 实体映射到 Web 服务调用中的 DTO 对象。这些实体中具有用于父子关系的 @OneToMany 和 @ManyToOne 关系。此外,我使用 Spring JPA 来创建这些实体。
将 Hibernate 实体映射到 POJO DTO 类时,map() 方法会导致加载所有延迟加载的属性。
@Entity
@Table(name="folders")
public class FolderEntity {
@Id
@GeneratedValue
private int id;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="consumerId")
private ConsumerEntity consumer;
Run Code Online (Sandbox Code Playgroud)
public class Folder
private int id;
private User consumer;
Run Code Online (Sandbox Code Playgroud)
Folder folder = mapper.map(some_folder_entity, Folder.class);
Run Code Online (Sandbox Code Playgroud)
在这种情况下,消费者属性映射会导致 Hibernate 加载子进程,这不是我想要的。
我虽然 HibernateUnenhanceStrategy 旨在通过删除 Hibernate 代理来解决此问题,但事实并非如此,或者我做错了。
@Component
public class MapperFacadeFactory implements FactoryBean<MapperFacade> {
public MapperFacade getObject() throws Exception {
DefaultMapperFactory.Builder factoryBuilder = new DefaultMapperFactory.Builder();
factoryBuilder.unenhanceStrategy(new …Run Code Online (Sandbox Code Playgroud) 我正在为我的iPhone游戏添加辅助功能,并广泛使用UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification,@"string")来宣布游戏中发生的各种事情.它在99%的时间内运行良好,但我遇到了一个问题.
在所有情况下,配音通知都是从我添加到应用程序委托的单个方法执行的.
- (void)voiceoverAction:(NSString *)speakString delay:(NSTimeInterval) delay {
if (![[[[UIDevice currentDevice] systemVersion] substringToIndex:1] isEqualToString:@"3"]) {
if (UIAccessibilityIsVoiceOverRunning()) {
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, speakString);
if (delay > 0) {
[NSThread sleepForTimeInterval:delay];
}
}
}
}
延迟就在那里,所以在游戏中发生下一个事件之前就会发出通知.我找不到更好的方法来确保在一些动画或其他事件切断之前发出整个公告.
在每种情况下,只有一个在调用此方法时立即说出通知.在一种情况下,在说话之前有大约10秒的暂停.在这种情况下,即使我调试代码并设置断点并手动执行UIAccessibilityPostNotification行,该行也会执行,但没有任何反应.然后10秒钟后,iPhone没有在调试器中做任何事情,iPhone就开始说出公告了.
关于这一个公告的唯一特别之处在于它是从UIScrollView的touchesEnded:事件中调用的.其他公告是整个游戏循环的一部分,并非基于触摸事件.
知道什么可能导致画外音排队可访问性通知而不是立即说出来吗?
先谢谢,史蒂夫