The following info was coppied from the treehugger website.
When an elephant pushes against the wires to get through to the crops, the hives swing violently, which sparks a fear in the elephant of a possible bee attack. The results of the pilot test are amazing, showing 86% fewer successful crop raids by elephants, and 150 fewer elephants even attempting a raid as compared to other farms in the control group.
Instead of using poison or guns, the idea uses natural instincts among animals to keep them out of human areas. The conflicts between humans and wildlife can be successfully reduced without anyone coming to harm.
You might be questioning the safety of the farmers - what if they or their children find themselves at the fence and the object of attack of the bees? Here's the most clever part. The hives in the pilot program weren't even occupied by bees!
The elephants have been known to be scared off by even just the recorded sound of buzzing bees. So the familiar sight and smell of hives, and the knowledge that a swinging hive might mean an eminent attack, was enough to keep the elephants at bay and everyone safe from bees.