Trains were bombed to pieces in Madrid in 2004[1], and since then there were multiple cases of terrorism in european trains. There were incidents galore already, so let's be optimistic that travel by train will stay free of airport-like security. :)
And in Spain you have to enter your ID card # and other personal info for the ticket, and occasional security checks, for all the long distance trains. So the difference to Germany is noticeable due to this history!