Actually, in Spain, we had to go through a metal detector to get on train from Sevilla to Madrid. Security wasn't as tight as for airplane boarding, and was very quick, but I was very surprised to find it there at all.
mmm, AFAIK , there are no metal detectors in AVE (Alta Velocidad - High Speed) trains in any of the 5 or so routes we have in Spain (just took a couple of them a week ago). They do we have a small x ray machine for carry on baggage, but the process is ridiculously fast (about 5 - 10 seconds total).
This is really important if you think that we do have an in active terrorist (or political liberation, according to some) group in Spain, which targeted those trains in the past.