[Persistence, JBoss/CMP, Hibernate, Database] - Enumtransfer between entities, one without EnumType.STRING
by cdebergh
Hello,
I have a application running on Jboss AS 4.2.2 that uses entities with enum attributes. I noticed an occurrence while stepping through a method that got me curious. After a get/set of an enum value from one entity to the other, the object being set contained the same null value it previously held. No exception was throw nor debug log printed. The entity getting from had an annotation for that field that stated @Enumerated(EnumType.STRING) while the entity being set did not have this annotation. However, as expected, an exception was encountered when the entity, that was set, was committed to the database.
I don't understand why the value was not transferred, or at least why no exception was thrown or error logged.
Here is some code to illustrate:
| public enum ColorEnum {
| BLONDE("Blonde"),
| RED("Red"),
| TAN("Tan");
| }
|
| @Entity
| @Table(name = "DOG")
| public class Dog {
| @Column(name = "COAT_COLOR"
| @Enumerated(EnumType.STRING)
| ColorEnum coatColor;
|
| public void setCoatColor(ColorEnum coatColor) {
| this.coatColor = coatColor;
| }
|
| public ColorEnumgetCoatColor() { return this.coatColor; }
| }
|
| @Entity
| @Table(name = "CAT")
| public class Cat {
| @Column(name = "COAT_COLOR"
| ColorEnum coatColor;
|
| public void setCoatColor(ColorEnum coatColor) {
| this.coatColor = coatColor;
| }
|
| public ColorEnumgetCoatColor() { return this.coatColor; }
| }
|
|
| public void newCatWithDogCoat() {
| ...
| // cat.getCoatColor() returns null
| // dog.getCoatColor() returns red
| cat.setCoatColor(dog.getCoatColor());
| ...
| // cat.getCoatColor() still returns null (no errors/exceptions)
| }
|
After adding @Enumerated(EnumType.STRING) to the Cat class, cat.getCoatColor() returns red
So why are there no exceptions/errors until it fails to save to the database?
Perhaps this is a bug?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221390#4221390
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221390
17 years
[Security & JAAS/JBoss] - Re: Mixing CLIENT-CERT and BASIC authentication
by fthurber
"alexanders" wrote : Not sure this question is in scope of the forum.
|
| Two things you need to describe in your web.xml:
| 1) Security constraint mapped to some url pattern and requires some role.
| 2) Role mapped to security domain.
|
| So you need to configure your web.xml as following:
| Two different security constraints mapped each to its url pattern
| e.g.
| <url-pattern>/*_cert_requred_*</url-pattern>
| requires some role: "CertProtected"
| <url-pattern>/*_passwd_requred_*</url-pattern>
| requires some role: "PasswordProtected"
|
| Best way to do this - separate your app to subcontexts:
| <url-pattern>/cert_requred/*</url-pattern>
| <url-pattern>/passwd_requred/*</url-pattern>
|
| Then you need to map each role to its JAAS domain.
|
| If you are mapping some security constraints to one url pattern (/*)... The result is depending on implementation. In best case you will got working the last constraint.
The key seems to be "map each role to its JAAS domain"; I cannot see how to do that. The choice of auth-method, either CLIENT-CERT or BASIC is made in the login-config element, but that is not mapped to a specific role, but it does seem to be mapped to a realm-name. Is there a mapping between realms and roles?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221388#4221388
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221388
17 years
[JBoss Cache: Core Edition] - Re: FD Issue
by karnivas
When one of the RHEL instance was brought down by killing the instance forcefully (kill -9 {PID}), the VIEW in the SOLARIS machines aren't updated even after testing with your suggestion.
The sample config is as follows
<attribute name="ClusterConfig">
| <config>
| <!-- UDP: if you have a multihomed machine,
| set the bind_addr attribute to the appropriate NIC IP address, e.g bind_addr="192.168.0.2"
| -->
| <!-- UDP: On Windows machines, because of the media sense feature
| being broken with multicast (even after disabling media sense)
| set the loopback attribute to true -->
| <UDP mcast_addr="224.7.8.9" mcast_port="45567"
| ip_ttl="64" ip_mcast="true"
| mcast_send_buf_size="150000" mcast_recv_buf_size="200000"
| ucast_send_buf_size="150000" ucast_recv_buf_size="200000"
| loopback="false" bind_addr="XX.XX.XX.XX"/>
| <PING timeout="2000" num_initial_members="3"
| up_thread="false" down_thread="false"/>
| <MERGE2 min_interval="10000" max_interval="20000"/>
| <FD shun="true" up_thread="true" down_thread="true" />
| <FD_SOCK/>
| <VERIFY_SUSPECT timeout="1500"
| up_thread="false" down_thread="false"/>
| <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
| max_xmit_size="8192" up_thread="false" down_thread="false" discard_delivered_msgs="true"/>
| <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
| down_thread="false"/>
| <pbcast.STABLE desired_avg_gossip="20000"
| up_thread="false" down_thread="false"/>
| <FRAG frag_size="8192"
| down_thread="false" up_thread="false"/>
| <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
| shun="true" print_local_addr="true"/>
| <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
| </config>
| </attribute>
Please suggest your thoughts in this.
Solaris and RHEL KEEP_ALIVE is with default(2hours) values
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221387#4221387
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221387
17 years