使用hibernate容易出现该问题,主要是由于pojo类属性存在级联关系。比如说员工和部门,在员工表里面有部门属性,而在部门表里面有个员工集合,这样就存在了嵌套引用的问题了,就会抛出这个异常。解决方法很简单,在将每个对象转为json对象的时候用setExcludes函数将级联的属性去除掉就可以了,...
分类:
编程语言 时间:
2015-01-29 14:09:24
阅读次数:
156
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *...
分类:
其他好文 时间:
2015-01-29 12:07:35
阅读次数:
117
什么是循环引用简单来说,循环引用就是:A 保留了 B, B 保留了 A, 造成 A 和 B 都不能被释放。id 为什么是 assign 而不是 retain从文章标题大概也能猜到, id 是 assign 而不是 retain 的原因是跟你循环引用有关系了。原因也确实如此。id 之所以是 assig...
分类:
其他好文 时间:
2015-01-24 17:16:33
阅读次数:
173
OC里面给变量赋值有2种方法
第一种是直接用下划线的,也就是实例变量:_button= 第二种是使用属性:self.button = ....这两种有何区别???
以下项目是创建了一个C++项目 简单模拟创建对象和给变量赋值的情况
首先创建了一个NSObject类,在OC里面继承NSObject类的都有retain release autorelease。。。。等方法来管...
分类:
编程语言 时间:
2015-01-24 16:02:43
阅读次数:
195
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?Has...
分类:
其他好文 时间:
2015-01-24 15:46:11
阅读次数:
118
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:1.可以用hash表记录链表中每个节点的地址,然后遍历发现重复,即有环,否则到...
分类:
其他好文 时间:
2015-01-24 15:43:21
阅读次数:
166
目的:自定义一个 Person 类,实现 copy.首先定义一个 Person 类,由于是自定义类,为了能够支持 copy 方法,需要实现协议@interface Person : NSObject@property (nonatomic, retain)NSString * name;@prope...
分类:
其他好文 时间:
2015-01-24 13:09:29
阅读次数:
191
对于对象类型,一般在声明属性的时候,都会将属性的特性设置为 retain 或者 copy, 这与设置成 assign 有什么区别呢?下面以 Student 类和 MyClass(班级)类为例来说明为什么要设置为 retain 或 copy.Student类@interface Student : N...
分类:
其他好文 时间:
2015-01-24 13:03:13
阅读次数:
180
1. 谁 alloc ,谁 release;2. 谁要占用谁retain;3. 谁不想占用对象时就 让对象计数器release;4.谁 retain,谁release; 1 // Book类 2 @interface Book:NSObject 3 4 { 5 6 int _pric...
分类:
其他好文 时间:
2015-01-23 06:05:53
阅读次数:
163
Problem A: The Monocycle
A monocycle is a cycle that runs on one wheel and the one we will be considering is a bit more special. It has a solid wheel colored with five different colors a...
分类:
其他好文 时间:
2015-01-22 18:15:25
阅读次数:
303