How to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist?
문제
Is it still possible to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist? In my properties file, I set
hibernate.bytecode.provider = cglib
But this doesn't seem to do it. Any thoughts?
해결책
It seems some people didn't read my answer correctly so I'll rephrase: your hibernate.properties
looks correct, the property is well defined, it should work. So, sorry for the question but is CGlib on the classpath?
Update: Just tested and it works for me. Here is the output I get at initialization time:
15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1 18 [main] INFO org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false, hibernate.bytecode.provider=cglib} 20 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib
PS: Note that CGLIB support has been deprecated recently (this doesn't mean you won't be able to use CGLIB but the integration it not maintained anymore).
다른 팁
Yeah, also put
hibernate.properties
into some source folder and remember to have the hibermate-cglib-repack in dependencies:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-cglib-repack</artifactId>
<version>2.1_3</version>
</dependency>
해당 목록에 대한 필드 개체를 만드는 기술을 믿지만 DataTable ()에 열 추가하는 것과 유사한 열을 실제로 추가하지는 않습니다.
코드를 통해 필드를 만들려면 일반적으로 로 이동합니다.
//Add Column to list
//GUID SPList.Fields.ADD(name,type,required);
list.Fields.Add("Field Name", SPFieldType.Choice, false);
//Get Field Reference
SPFieldChoice col = (SPFieldChoice) list.Fields["Field Name"];
col.Choices.Add("option 1");
col.Choices.Add("option 2");
col.DefaultValue = "option 1"; //otherwise blank row by default.
col.update(); //Saves choices to column
list.update();
.